本文整理匯總了Java中org.apache.catalina.Context.getPath方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.getPath方法的具體用法?Java Context.getPath怎麽用?Java Context.getPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.catalina.Context
的用法示例。
在下文中一共展示了Context.getPath方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unregisterWrapper
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Unregister wrapper.
*/
private void unregisterWrapper(Wrapper wrapper) {
Context context = (Context) wrapper.getParent();
String contextPath = context.getPath();
String wrapperName = wrapper.getName();
if ("/".equals(contextPath)) {
contextPath = "";
}
String version = context.getWebappVersion();
String hostName = context.getParent().getName();
String[] mappings = wrapper.findMappings();
for (String mapping : mappings) {
mapper.removeWrapper(hostName, contextPath, version, mapping);
}
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterWrapper",
wrapperName, contextPath, connector));
}
}
示例2: registerWrapper
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Register wrapper.
*/
private void registerWrapper(Wrapper wrapper) {
Context context = (Context) wrapper.getParent();
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
String version = context.getWebappVersion();
String hostName = context.getParent().getName();
List<WrapperMappingInfo> wrappers = new ArrayList<WrapperMappingInfo>();
prepareWrapperMappingInfo(context, wrapper, wrappers);
mapper.addWrappers(hostName, contextPath, version, wrappers);
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerWrapper",
wrapper.getName(), contextPath, connector));
}
}
示例3: customize
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Customize the specified context to have its own log file instead of
* inheriting the default one. This is just an example of what you can
* do; pretty much anything (such as installing special Valves) can
* be done prior to calling <code>start()</code>.
*
* @param context Context to receive a specialized logger
*/
private static void customize(Context context) {
// Create a customized file logger for this context
String basename = context.getPath();
if (basename.length() < 1)
basename = "ROOT";
else
basename = basename.substring(1);
FileLogger special = new FileLogger();
special.setPrefix(basename + "_log.");
special.setSuffix(".txt");
special.setTimestamp(true);
// Override the default logger for this context
context.setLogger(special);
}
示例4: addChild
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Delegate a request to add a child Context to our associated Host.
*
* @param child The child Context to be added
*/
public void addChild(Container child) {
context = (Context) child;
String contextPath = context.getPath();
if (contextPath == null)
throw new IllegalArgumentException
(sm.getString("standardHost.pathRequired"));
else if (!contextPath.equals("") && !contextPath.startsWith("/"))
throw new IllegalArgumentException
(sm.getString("standardHost.pathFormat", contextPath));
if (host.findChild(contextPath) != null)
throw new IllegalStateException
(sm.getString("standardHost.pathUsed", contextPath));
if (this.overrideDocBase != null)
context.setDocBase(this.overrideDocBase);
host.fireContainerEvent(PRE_INSTALL_EVENT, context);
host.addChild(child);
host.fireContainerEvent(INSTALL_EVENT, context);
}
示例5: list
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Render a list of the currently active Contexts in our virtual host.
*
* @param writer
* Writer to render to
*/
protected void list(PrintWriter writer, StringManager smClient) {
if (debug >= 1)
log("list: Listing contexts for virtual host '" + host.getName() + "'");
writer.println(smClient.getString("managerServlet.listed", host.getName()));
Container[] contexts = host.findChildren();
for (int i = 0; i < contexts.length; i++) {
Context context = (Context) contexts[i];
if (context != null) {
String displayPath = context.getPath();
if (displayPath.equals(""))
displayPath = "/";
if (context.getState().isAvailable()) {
writer.println(smClient.getString("managerServlet.listitem", displayPath, "running",
"" + context.getManager().findSessions().length, context.getDocBase()));
} else {
writer.println(smClient.getString("managerServlet.listitem", displayPath, "stopped", "0",
context.getDocBase()));
}
}
}
}
示例6: unregisterWrapper
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Unregister wrapper.
*/
private void unregisterWrapper(Wrapper wrapper) {
Context context = (Context) wrapper.getParent();
String contextPath = context.getPath();
String wrapperName = wrapper.getName();
if ("/".equals(contextPath)) {
contextPath = "";
}
String version = context.getWebappVersion();
String hostName = context.getParent().getName();
String[] mappings = wrapper.findMappings();
for (String mapping : mappings) {
mapper.removeWrapper(hostName, contextPath, version, mapping);
}
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterWrapper", wrapperName, contextPath, connector));
}
}
示例7: registerWrapper
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Register wrapper.
*/
private void registerWrapper(Wrapper wrapper) {
Context context = (Context) wrapper.getParent();
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
String version = context.getWebappVersion();
String hostName = context.getParent().getName();
List<WrapperMappingInfo> wrappers = new ArrayList<WrapperMappingInfo>();
prepareWrapperMappingInfo(context, wrapper, wrappers);
mapper.addWrappers(hostName, contextPath, version, wrappers);
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerWrapper", wrapper.getName(), contextPath, connector));
}
}
示例8: list
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Render a list of the currently active Contexts in our virtual host.
*
* @param writer Writer to render to
*/
protected void list(PrintWriter writer, StringManager smClient) {
if (debug >= 1)
log("list: Listing contexts for virtual host '" +
host.getName() + "'");
writer.println(smClient.getString("managerServlet.listed",
host.getName()));
Container[] contexts = host.findChildren();
for (int i = 0; i < contexts.length; i++) {
Context context = (Context) contexts[i];
if (context != null ) {
String displayPath = context.getPath();
if( displayPath.equals("") )
displayPath = "/";
if (context.getState().isAvailable()) {
writer.println(smClient.getString("managerServlet.listitem",
displayPath,
"running",
"" + context.getManager().findSessions().length,
context.getDocBase()));
} else {
writer.println(smClient.getString("managerServlet.listitem",
displayPath,
"stopped",
"0",
context.getDocBase()));
}
}
}
}
示例9: registerContext
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Register context.
*/
private void registerContext(Context context) {
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
Container host = context.getParent();
javax.naming.Context resources = context.getResources();
String[] welcomeFiles = context.findWelcomeFiles();
List<WrapperMappingInfo> wrappers = new ArrayList<WrapperMappingInfo>();
for (Container container : context.findChildren()) {
prepareWrapperMappingInfo(context, (Wrapper) container, wrappers);
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerWrapper",
container.getName(), contextPath, connector));
}
}
mapper.addContextVersion(host.getName(), host, contextPath,
context.getWebappVersion(), context, welcomeFiles, resources,
wrappers, context.getMapperContextRootRedirectEnabled(),
context.getMapperDirectoryRedirectEnabled());
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerContext",
contextPath, connector));
}
}
示例10: unregisterContext
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Unregister context.
*/
private void unregisterContext(Context context) {
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
String hostName = context.getParent().getName();
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterContext",
contextPath, connector));
}
if (context.getPaused()) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.pauseContext",
contextPath, connector));
}
mapper.pauseContextVersion(context, hostName, contextPath,
context.getWebappVersion());
} else {
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterContext",
contextPath, connector));
}
mapper.removeContextVersion(hostName, contextPath,
context.getWebappVersion());
}
}
示例11: list
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Render a list of the currently active Contexts in our virtual host.
*
* @param writer Writer to render to
*/
protected void list(PrintWriter writer) {
if (debug >= 1)
log("list: Listing contexts for virtual host '" +
host.getName() + "'");
writer.println(sm.getString("managerServlet.listed",
host.getName()));
Container[] contexts = host.findChildren();
for (int i = 0; i < contexts.length; i++) {
Context context = (Context) contexts[i];
String displayPath = context.getPath();
if( displayPath.equals("") )
displayPath = "/";
if (context != null ) {
if (context.getAvailable()) {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"running",
"" + context.getManager().findSessions().length,
context.getDocBase()));
} else {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"stopped",
"0",
context.getDocBase()));
}
}
}
}
示例12: registerContext
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Register context.
*/
private void registerContext(Context context) {
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
Container host = context.getParent();
javax.naming.Context resources = context.getResources();
String[] welcomeFiles = context.findWelcomeFiles();
List<WrapperMappingInfo> wrappers = new ArrayList<WrapperMappingInfo>();
for (Container container : context.findChildren()) {
prepareWrapperMappingInfo(context, (Wrapper) container, wrappers);
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerWrapper",
container.getName(), contextPath, connector));
}
}
mapper.addContextVersion(host.getName(), host, contextPath,
context.getWebappVersion(), context, welcomeFiles, resources,
wrappers, context.getMapperContextRootRedirectEnabled(),//default false
context.getMapperDirectoryRedirectEnabled());//default false
if(log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerContext",
contextPath, connector));
}
}
示例13: registerContext
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Register context.
*/
private void registerContext(Context context) {
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
Container host = context.getParent();
javax.naming.Context resources = context.getResources();
String[] welcomeFiles = context.findWelcomeFiles();
List<WrapperMappingInfo> wrappers = new ArrayList<WrapperMappingInfo>();
for (Container container : context.findChildren()) {
prepareWrapperMappingInfo(context, (Wrapper) container, wrappers);
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerWrapper", container.getName(), contextPath, connector));
}
}
mapper.addContextVersion(host.getName(), host, contextPath, context.getWebappVersion(), context, welcomeFiles,
resources, wrappers, context.getMapperContextRootRedirectEnabled(),
context.getMapperDirectoryRedirectEnabled());
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.registerContext", contextPath, connector));
}
}
示例14: unregisterContext
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Unregister context.
*/
private void unregisterContext(Context context) {
String contextPath = context.getPath();
if ("/".equals(contextPath)) {
contextPath = "";
}
String hostName = context.getParent().getName();
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterContext", contextPath, connector));
}
if (context.getPaused()) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.pauseContext", contextPath, connector));
}
mapper.pauseContextVersion(context, hostName, contextPath, context.getWebappVersion());
} else {
if (log.isDebugEnabled()) {
log.debug(sm.getString("mapperListener.unregisterContext", contextPath, connector));
}
mapper.removeContextVersion(hostName, contextPath, context.getWebappVersion());
}
}