本文整理汇总了Java中org.apache.naming.resources.BaseDirContext类的典型用法代码示例。如果您正苦于以下问题:Java BaseDirContext类的具体用法?Java BaseDirContext怎么用?Java BaseDirContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseDirContext类属于org.apache.naming.resources包,在下文中一共展示了BaseDirContext类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addResourceJarUrl
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Add a URL for a JAR that contains static resources in a
* META-INF/resources directory that should be included in the static
* resources for this context.
*/
@Override
public void addResourceJarUrl(URL url) {
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).addResourcesJar(url);
} else {
log.error(sm.getString("standardContext.noResourceJar", url,
getName()));
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:StandardContext.java
示例2: addResourcesDirContext
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Add a URL for a JAR that contains static resources in a
* META-INF/resources directory that should be included in the static
* resources for this context.
*/
public void addResourcesDirContext(DirContext altDirContext) {
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).addAltDirContext(altDirContext);
} else {
log.error(sm.getString("standardContext.noResourceJar", altDirContext,
getName()));
}
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:StandardContext.java
示例3: setResources
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources The newly associated DirContext
*/
@Override
public synchronized void setResources(DirContext resources) {
if (getState().isAvailable()) {
throw new IllegalStateException
(sm.getString("standardContext.resourcesStart"));
}
DirContext oldResources = this.webappResources;
if (oldResources == resources)
return;
if (resources instanceof BaseDirContext) {
// Caching
((BaseDirContext) resources).setCached(isCachingAllowed());
((BaseDirContext) resources).setCacheTTL(getCacheTTL());
((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize());
((BaseDirContext) resources).setCacheObjectMaxSize(
getCacheObjectMaxSize());
// Alias support
((BaseDirContext) resources).setAliases(getAliases());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) resources).setAllowLinking(isAllowLinking());
}
this.webappResources = resources;
// The proxied resources will be refreshed on start
this.resources = null;
support.firePropertyChange("resources", oldResources,
this.webappResources);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:42,代码来源:StandardContext.java
示例4: getRealPath
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Return the real path for a given virtual path, if possible; otherwise
* return <code>null</code>.
*
* @param path The path to the desired resource
*/
@Override
public String getRealPath(String path) {
if (webappResources instanceof BaseDirContext) {
return ((BaseDirContext) webappResources).getRealPath(path);
}
return null;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:StandardContext.java
示例5: resourcesStop
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Deallocate resources and destroy proxy.
*/
public boolean resourcesStop() {
boolean ok = true;
try {
if (resources != null) {
if (resources instanceof Lifecycle) {
((Lifecycle) resources).stop();
}
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).release();
}
// Unregister the cache in JMX
if (isCachingAllowed()) {
String contextName = getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName resourcesName =
new ObjectName(this.getDomain()
+ ":type=Cache,host="
+ getHostname() + ",context="
+ contextName);
Registry.getRegistry(null, null)
.unregisterComponent(resourcesName);
}
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardContext.resourcesStop"), t);
ok = false;
}
this.resources = null;
return (ok);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:42,代码来源:StandardContext.java
示例6: setResources
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources The newly associated DirContext
*/
public synchronized void setResources(DirContext resources) {
if (started) {
throw new IllegalStateException
(sm.getString("standardContext.resources.started"));
}
DirContext oldResources = this.webappResources;
if (oldResources == resources)
return;
if (resources instanceof BaseDirContext) {
((BaseDirContext) resources).setCached(isCachingAllowed());
((BaseDirContext) resources).setCacheTTL(getCacheTTL());
((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize());
((BaseDirContext) resources).setCacheObjectMaxSize(getCacheObjectMaxSize());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) resources).setCaseSensitive(isCaseSensitive());
((FileDirContext) resources).setAllowLinking(isAllowLinking());
}
this.webappResources = resources;
// The proxied resources will be refreshed on start
this.resources = null;
support.firePropertyChange("resources", oldResources,
this.webappResources);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:StandardContext.java
示例7: resourcesStop
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Deallocate resources and destroy proxy.
*/
public boolean resourcesStop() {
boolean ok = true;
try {
if (resources != null) {
if (resources instanceof Lifecycle) {
((Lifecycle) resources).stop();
}
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).release();
}
// Unregister the cache in JMX
if (isCachingAllowed()) {
ObjectName resourcesName =
new ObjectName(this.getDomain()
+ ":type=Cache,host="
+ getHostname() + ",path="
+ (("".equals(getPath()))?"/"
:getPath()));
Registry.getRegistry(null, null)
.unregisterComponent(resourcesName);
}
}
} catch (Throwable t) {
log.error(sm.getString("standardContext.resourcesStop"), t);
ok = false;
}
this.resources = null;
return (ok);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:StandardContext.java
示例8: setResources
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources The newly associated DirContext
*/
public synchronized void setResources(DirContext resources) {
if (resources instanceof BaseDirContext) {
((BaseDirContext) resources).setCached(isCachingAllowed());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
}
super.setResources(resources);
if (started)
postResources(); // As a servlet context attribute
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:20,代码来源:StandardContext.java
示例9: addResourceJarUrl
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Add a URL for a JAR that contains static resources in a
* META-INF/resources directory that should be included in the static
* resources for this context.
*/
@Override
public void addResourceJarUrl(URL url) {
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).addResourcesJar(url);
} else {
log.error(sm.getString("standardContext.noResourceJar", url, getName()));
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:14,代码来源:StandardContext.java
示例10: addResourcesDirContext
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Add a URL for a JAR that contains static resources in a
* META-INF/resources directory that should be included in the static
* resources for this context.
*/
public void addResourcesDirContext(DirContext altDirContext) {
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).addAltDirContext(altDirContext);
} else {
log.error(sm.getString("standardContext.noResourceJar", altDirContext, getName()));
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:13,代码来源:StandardContext.java
示例11: setResources
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources
* The newly associated DirContext
*/
@Override
public synchronized void setResources(DirContext resources) {
if (getState().isAvailable()) {
throw new IllegalStateException(sm.getString("standardContext.resourcesStart"));
}
DirContext oldResources = this.webappResources;
if (oldResources == resources)
return;
if (resources instanceof BaseDirContext) {
// Caching
((BaseDirContext) resources).setCached(isCachingAllowed());
((BaseDirContext) resources).setCacheTTL(getCacheTTL());
((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize());
((BaseDirContext) resources).setCacheObjectMaxSize(getCacheObjectMaxSize());
// Alias support
((BaseDirContext) resources).setAliases(getAliases());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) resources).setAllowLinking(isAllowLinking());
}
this.webappResources = resources;
// The proxied resources will be refreshed on start
this.resources = null;
support.firePropertyChange("resources", oldResources, this.webappResources);
}
开发者ID:how2j,项目名称:lazycat,代码行数:40,代码来源:StandardContext.java
示例12: getRealPath
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Return the real path for a given virtual path, if possible; otherwise
* return <code>null</code>.
*
* @param path
* The path to the desired resource
*/
@Override
public String getRealPath(String path) {
if (webappResources instanceof BaseDirContext) {
return ((BaseDirContext) webappResources).getRealPath(path);
}
return null;
}
开发者ID:how2j,项目名称:lazycat,代码行数:15,代码来源:StandardContext.java
示例13: resourcesStop
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Deallocate resources and destroy proxy.
*/
public boolean resourcesStop() {
boolean ok = true;
try {
if (resources != null) {
if (resources instanceof Lifecycle) {
((Lifecycle) resources).stop();
}
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).release();
}
// Unregister the cache in JMX
if (isCachingAllowed()) {
String contextName = getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName resourcesName = new ObjectName(
this.getDomain() + ":type=Cache,host=" + getHostname() + ",context=" + contextName);
Registry.getRegistry(null, null).unregisterComponent(resourcesName);
}
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardContext.resourcesStop"), t);
ok = false;
}
this.resources = null;
return (ok);
}
开发者ID:how2j,项目名称:lazycat,代码行数:38,代码来源:StandardContext.java
示例14: setResources
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Set the resources DirContext object with which this Container is
* associated.
*
* @param resources The newly associated DirContext
*/
@Override
public synchronized void setResources(DirContext resources) {
if (getState().isAvailable()) {
throw new IllegalStateException
(sm.getString("standardContext.resources.started"));
}
DirContext oldResources = this.webappResources;
if (oldResources == resources)
return;
if (resources instanceof BaseDirContext) {
// Caching
((BaseDirContext) resources).setCached(isCachingAllowed());
((BaseDirContext) resources).setCacheTTL(getCacheTTL());
((BaseDirContext) resources).setCacheMaxSize(getCacheMaxSize());
((BaseDirContext) resources).setCacheObjectMaxSize(
getCacheObjectMaxSize());
// Alias support
((BaseDirContext) resources).setAliases(getAliases());
}
if (resources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) resources).setAllowLinking(isAllowLinking());
}
this.webappResources = resources;
// The proxied resources will be refreshed on start
this.resources = null;
support.firePropertyChange("resources", oldResources,
this.webappResources);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:42,代码来源:StandardContext.java
示例15: resourcesStart
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Allocate resources, including proxy.
* Return <code>true</code> if initialization was successfull,
* or <code>false</code> otherwise.
*/
public boolean resourcesStart() {
boolean ok = true;
Hashtable<String, String> env = new Hashtable<String, String>();
if (getParent() != null)
env.put(ProxyDirContext.HOST, getParent().getName());
env.put(ProxyDirContext.CONTEXT, getName());
try {
ProxyDirContext proxyDirContext =
new ProxyDirContext(env, webappResources);
if (webappResources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) webappResources).setAllowLinking
(isAllowLinking());
}
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).setDocBase(getBasePath());
((BaseDirContext) webappResources).setCached
(isCachingAllowed());
((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
((BaseDirContext) webappResources).setCacheMaxSize
(getCacheMaxSize());
((BaseDirContext) webappResources).allocate();
// Alias support
((BaseDirContext) webappResources).setAliases(getAliases());
if (effectiveMajorVersion >=3 && addWebinfClassesResources) {
try {
DirContext webInfCtx =
(DirContext) webappResources.lookup(
"/WEB-INF/classes");
// Do the lookup to make sure it exists
webInfCtx.lookup("META-INF/resources");
((BaseDirContext) webappResources).addAltDirContext(
webInfCtx);
} catch (NamingException e) {
// Doesn't exist - ignore and carry on
}
}
}
// Register the cache in JMX
if (isCachingAllowed() && proxyDirContext.getCache() != null) {
String contextName = getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName resourcesName =
new ObjectName(this.getDomain() + ":type=Cache,host="
+ getHostname() + ",context=" + contextName);
Registry.getRegistry(null, null).registerComponent
(proxyDirContext.getCache(), resourcesName, null);
}
this.resources = proxyDirContext;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardContext.resourcesStart"), t);
ok = false;
}
return (ok);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:70,代码来源:StandardContext.java
示例16: resourcesStart
import org.apache.naming.resources.BaseDirContext; //导入依赖的package包/类
/**
* Allocate resources, including proxy.
* Return <code>true</code> if initialization was successfull,
* or <code>false</code> otherwise.
*/
public boolean resourcesStart() {
boolean ok = true;
Hashtable env = new Hashtable();
if (getParent() != null)
env.put(ProxyDirContext.HOST, getParent().getName());
env.put(ProxyDirContext.CONTEXT, getName());
try {
ProxyDirContext proxyDirContext =
new ProxyDirContext(env, webappResources);
if (webappResources instanceof FileDirContext) {
filesystemBased = true;
((FileDirContext) webappResources).setCaseSensitive
(isCaseSensitive());
((FileDirContext) webappResources).setAllowLinking
(isAllowLinking());
}
if (webappResources instanceof BaseDirContext) {
((BaseDirContext) webappResources).setDocBase(getBasePath());
((BaseDirContext) webappResources).setCached
(isCachingAllowed());
((BaseDirContext) webappResources).setCacheTTL(getCacheTTL());
((BaseDirContext) webappResources).setCacheMaxSize
(getCacheMaxSize());
((BaseDirContext) webappResources).allocate();
}
// Register the cache in JMX
if (isCachingAllowed()) {
ObjectName resourcesName =
new ObjectName(this.getDomain() + ":type=Cache,host="
+ getHostname() + ",path="
+ (("".equals(getPath()))?"/":getPath()));
Registry.getRegistry(null, null).registerComponent
(proxyDirContext.getCache(), resourcesName, null);
}
this.resources = proxyDirContext;
} catch (Throwable t) {
log.error(sm.getString("standardContext.resourcesStart"), t);
ok = false;
}
return (ok);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:StandardContext.java
注:本文中的org.apache.naming.resources.BaseDirContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论