本文整理汇总了Java中org.apache.catalina.Context.getAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getAvailable方法的具体用法?Java Context.getAvailable怎么用?Java Context.getAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.Context
的用法示例。
在下文中一共展示了Context.getAvailable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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()));
}
}
}
}
示例2: start
import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
* Start the web application at the specified context path.
*
* @param writer Writer to render to
* @param path Context path of the application to be started
*/
protected void start(PrintWriter writer, String path) {
if (debug >= 1)
log("start: Starting web application at '" + path + "'");
if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
writer.println(sm.getString("managerServlet.invalidPath",
RequestUtil.filter(path)));
return;
}
String displayPath = path;
if( path.equals("/") )
path = "";
try {
Context context = (Context) host.findChild(path);
if (context == null) {
writer.println(sm.getString("managerServlet.noContext",
RequestUtil.filter(displayPath)));
return;
}
((Lifecycle) context).start();
if (context.getAvailable())
writer.println
(sm.getString("managerServlet.started", displayPath));
else
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
} catch (Throwable t) {
getServletContext().log
(sm.getString("managerServlet.startFailed", displayPath), t);
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
writer.println(sm.getString("managerServlet.exception",
t.toString()));
}
}
示例3: 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 '" +
deployer.getName() + "'");
writer.println(sm.getString("managerServlet.listed",
deployer.getName()));
String contextPaths[] = deployer.findDeployedApps();
for (int i = 0; i < contextPaths.length; i++) {
Context context = deployer.findDeployedApp(contextPaths[i]);
String displayPath = contextPaths[i];
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()));
}
}
}
}
示例4: start
import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
* Start the web application at the specified context path.
*
* @param writer Writer to render to
* @param path Context path of the application to be started
*/
protected void start(PrintWriter writer, String path) {
if (debug >= 1)
log("start: Starting web application at '" + path + "'");
if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
writer.println(sm.getString("managerServlet.invalidPath", path));
return;
}
String displayPath = path;
if( path.equals("/") )
path = "";
try {
Context context = deployer.findDeployedApp(path);
if (context == null) {
writer.println(sm.getString("managerServlet.noContext", displayPath));
return;
}
deployer.start(path);
if (context.getAvailable())
writer.println
(sm.getString("managerServlet.started", displayPath));
else
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
} catch (Throwable t) {
getServletContext().log
(sm.getString("managerServlet.startFailed", displayPath), t);
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
writer.println(sm.getString("managerServlet.exception",
t.toString()));
}
}
示例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(final PrintWriter writer) {
if (debug >= 1) {
log("list: Listing contexts for virtual host '" +
deployer.getName() + '\'');
}
writer.println(sm.getString("managerServlet.listed",
deployer.getName()));
final String[] contextPaths = deployer.findDeployedApps();
for (int i = 0; i < contextPaths.length; i++) {
final Context context = deployer.findDeployedApp(contextPaths[i]);
String displayPath = contextPaths[i];
if (displayPath.length() == 0) {
displayPath = "/";
}
if (context != null) {
if (context.getAvailable()) {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"running",
String.valueOf(context.getManager().findSessions().length),
context.getDocBase()));
} else {
writer.println(sm.getString("managerServlet.listitem",
displayPath,
"stopped",
"0",
context.getDocBase()));
}
}
}
}
示例6: start
import org.apache.catalina.Context; //导入方法依赖的package包/类
/**
* Start the web application at the specified context path.
*
* @param writer Writer to render to
* @param path Context path of the application to be started
*/
protected void start(final PrintWriter writer, String path) {
if (debug >= 1) {
log("start: Starting web application at '" + path + '\'');
}
if (path == null || !path.startsWith("/") && path.length() == 0) {
writer.println(sm.getString("managerServlet.invalidPath", path));
return;
}
final String displayPath = path;
if (path.equals("/")) {
path = "";
}
try {
final Context context = deployer.findDeployedApp(path);
if (context == null) {
writer.println(sm.getString("managerServlet.noContext", displayPath));
return;
}
deployer.start(path);
if (context.getAvailable()) {
writer.println
(sm.getString("managerServlet.started", displayPath));
} else {
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
}
} catch (Throwable t) {
getServletContext().log
(sm.getString("managerServlet.startFailed", displayPath), t);
writer.println
(sm.getString("managerServlet.startFailed", displayPath));
writer.println(sm.getString("managerServlet.exception",
t.toString()));
}
}