本文整理了Java中org.apache.catalina.Context.reload()
方法的一些代码示例,展示了Context.reload()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.reload()
方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:reload
[英]Reload this web application, if reloading is supported.
[中]如果支持重新加载,请重新加载此web应用程序。
代码示例来源:origin: psi-probe/psi-probe
@Override
protected void executeAction(String contextName) throws Exception {
Context context = getContainerWrapper().getTomcatContainer().findContext(contextName);
if (context != null) {
context.reload();
// Logging action
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
// get username logger
String name = auth.getName();
logger.info(getMessageSourceAccessor().getMessage("probe.src.log.reload"), name, contextName);
}
}
代码示例来源:origin: psi-probe/psi-probe
@Override
protected ModelAndView handleContext(String contextName, Context context,
HttpServletRequest request, HttpServletResponse response) throws Exception {
if (context != null && !request.getContextPath().equals(contextName)) {
try {
logger.info("{} requested RELOAD of {}", request.getRemoteAddr(), contextName);
context.reload();
// Logging action
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
// get username logger
String name = auth.getName();
logger.info(getMessageSourceAccessor().getMessage("probe.src.log.reload"), name,
contextName);
} catch (Exception e) {
logger.error("Error during ajax request to RELOAD of '{}'", contextName, e);
}
}
return new ModelAndView(getViewName(), "available",
context != null && getContainerWrapper().getTomcatContainer().getAvailable(context));
}
代码示例来源:origin: magro/memcached-session-manager
/**
* Test for issue 174: sessions lost on Tomcat 7 reload
* http://code.google.com/p/memcached-session-manager/issues/detail?id=174
*/
@Test( enabled = true )
public void testContextReload() throws IOException, InterruptedException, HttpException {
final String sessionId1 = post( _httpClient, _portTomcat1, null, "foo", "bar" ).getSessionId();
assertNotNull( sessionId1, "No session created." );
_tomcat1.getContext().reload();
final Response response = get( _httpClient, _portTomcat1, sessionId1 );
final String actualValue = response.get( "foo" );
assertEquals( "bar", actualValue );
}
代码示例来源:origin: psi-probe/psi-probe
context.reload();
request.setAttribute("reloadContext", Boolean.TRUE);
logger.info(getMessageSourceAccessor().getMessage("probe.src.log.reload"), name,
代码示例来源:origin: org.apache.meecrowave/meecrowave-core
protected synchronized void redeploy() {
context.reload();
}
代码示例来源:origin: apache/meecrowave
protected synchronized void redeploy() {
context.reload();
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Execute a periodic task, such as reloading, etc. This method will be
* invoked inside the classloading context of this container. Unexpected
* throwables will be caught and logged.
*/
@Override
public void backgroundProcess() {
if (reloadable && modified()) {
try {
Thread.currentThread().setContextClassLoader
(WebappLoader.class.getClassLoader());
if (context != null) {
context.reload();
}
} finally {
if (context != null && context.getLoader() != null) {
Thread.currentThread().setContextClassLoader
(context.getLoader().getClassLoader());
}
}
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Execute a periodic task, such as reloading, etc. This method will be
* invoked inside the classloading context of this container. Unexpected
* throwables will be caught and logged.
*/
@Override
public void backgroundProcess() {
if (reloadable && modified()) {
try {
Thread.currentThread().setContextClassLoader
(WebappLoader.class.getClassLoader());
if (context != null) {
context.reload();
}
} finally {
if (context != null && context.getLoader() != null) {
Thread.currentThread().setContextClassLoader
(context.getLoader().getClassLoader());
}
}
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
/**
* Execute a periodic task, such as reloading, etc. This method will be
* invoked inside the classloading context of this container. Unexpected
* throwables will be caught and logged.
*/
@Override
public void backgroundProcess() {
if (reloadable && modified()) {
try {
Thread.currentThread().setContextClassLoader
(WebappLoader.class.getClassLoader());
if (context != null) {
context.reload();
}
} finally {
if (context != null && context.getLoader() != null) {
Thread.currentThread().setContextClassLoader
(context.getLoader().getClassLoader());
}
}
}
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: codefollower/Tomcat-Research
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
return;
context.reload();
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
代码示例来源:origin: codefollower/Tomcat-Research
private void reload(DeployedApplication app) {
if(log.isInfoEnabled())
log.info(sm.getString("hostConfig.reload", app.name));
Context context = (Context) host.findChild(app.name);
if (context.getState().isAvailable()) {
// Reload catches and logs exceptions
context.reload();
} else {
// If the context was not started (for example an error
// in web.xml) we'll still get to try to start
try {
context.start();
} catch (Exception e) {
log.warn(sm.getString
("hostConfig.context.restart", app.name), e);
}
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
private void reload(DeployedApplication app, File fileToRemove, String newDocBase) {
if(log.isInfoEnabled())
log.info(sm.getString("hostConfig.reload", app.name));
Context context = (Context) host.findChild(app.name);
if (context.getState().isAvailable()) {
if (fileToRemove != null && newDocBase != null) {
context.addLifecycleListener(
new ExpandedDirectoryRemovalListener(fileToRemove, newDocBase));
}
// Reload catches and logs exceptions
context.reload();
} else {
// If the context was not started (for example an error
// in web.xml) we'll still get to try to start
if (fileToRemove != null && newDocBase != null) {
ExpandWar.delete(fileToRemove);
context.setDocBase(newDocBase);
}
try {
context.start();
} catch (Exception e) {
log.warn(sm.getString
("hostConfig.context.restart", app.name), e);
}
}
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private void reload(DeployedApplication app, File fileToRemove, String newDocBase) {
if(log.isInfoEnabled())
log.info(sm.getString("hostConfig.reload", app.name));
Context context = (Context) host.findChild(app.name);
if (context.getState().isAvailable()) {
if (fileToRemove != null && newDocBase != null) {
context.addLifecycleListener(
new ExpandedDirectoryRemovalListener(fileToRemove, newDocBase));
}
// Reload catches and logs exceptions
context.reload();
} else {
// If the context was not started (for example an error
// in web.xml) we'll still get to try to start
if (fileToRemove != null && newDocBase != null) {
ExpandWar.delete(fileToRemove);
context.setDocBase(newDocBase);
}
try {
context.start();
} catch (Exception e) {
log.warn(sm.getString
("hostConfig.context.restart", app.name), e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!