本文整理匯總了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()));
}
}