@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); } }
@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)); }
/** * 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 ); }
context.reload(); request.setAttribute("reloadContext", Boolean.TRUE); logger.info(getMessageSourceAccessor().getMessage("probe.src.log.reload"), name,
protected synchronized void redeploy() { context.reload(); }
protected synchronized void redeploy() { context.reload(); }
/** * 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()); } } } }
/** * 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()); } } } }
/** * 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()); } } } }
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
return; context.reload(); writer.println(smClient.getString("managerServlet.reloaded", cn.getDisplayName()));
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); } } }
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); } } }
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); } } }