@Override public void lifecycleEvent(LifecycleEvent event) { if (event.getType().equals(Lifecycle.START_EVENT)) { Context context = (Context) event.getLifecycle(); Manager manager = context.getManager(); if (manager != null && manager instanceof StandardManager) { ((StandardManager) manager).setPathname(null); } } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { // Get the Manager Manager manager = request.getContext().getManager(); // If it is an AbstractManager, handle possible failover if (manager instanceof DeltaSessionManager) { DeltaSessionManager absMgr = (DeltaSessionManager) manager; String localJvmRoute = absMgr.getJvmRoute(); if (localJvmRoute != null) { handlePossibleFailover(request, absMgr, localJvmRoute); } } // Invoke the next Valve getNext().invoke(request, response); }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { String sessionId = request.getRequestedSessionId(); Session session = request.getContext().getManager().findSession(sessionId); if (session != null) { if (!session.isValid()) { session.expire(); request.getContext().getManager().remove(session); } else { manager.add(session); session.access(); session.endAccess(); } } try { getNext().invoke(request, response); } finally { manager.store(request.getSession(false)); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { String sessionId = request.getRequestedSessionId(); Session session = request.getContext().getManager().findSession(sessionId); if (session != null) { if (!session.isValid()) { session.expire(); request.getContext().getManager().remove(session); } else { manager.add(session); session.access(); session.endAccess(); } } try { getNext().invoke(request, response); } finally { manager.store(request.getSession(false)); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { String sessionId = request.getRequestedSessionId(); Session session = request.getContext().getManager().findSession(sessionId); if (session != null) { if (!session.isValid()) { session.expire(); request.getContext().getManager().remove(session); } else { manager.add(session); session.access(); session.endAccess(); } } try { getNext().invoke(request, response); } finally { manager.store(request.getSession(false)); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { String sessionId = request.getRequestedSessionId(); Session session = request.getContext().getManager().findSession(sessionId); if (session != null) { if (!session.isValid()) { session.expire(); request.getContext().getManager().remove(session); } else { manager.add(session); session.access(); session.endAccess(); } } try { getNext().invoke(request, response); } finally { manager.store(request.getSession(false)); } }
private void configureSession(Context context) { long sessionTimeout = getSessionTimeoutInMinutes(); context.setSessionTimeout((int) sessionTimeout); Boolean httpOnly = getSession().getCookie().getHttpOnly(); if (httpOnly != null) { context.setUseHttpOnly(httpOnly); } if (getSession().isPersistent()) { Manager manager = context.getManager(); if (manager == null) { manager = new StandardManager(); context.setManager(manager); } configurePersistSession(manager); } else { context.addLifecycleListener(new DisablePersistSessionListener()); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { Manager manager = request.getContext().getManager(); DeltaSessionFacade session = null;
private Manager findManager(ApplicationContext applicationContext) { if (applicationContext instanceof WebServerApplicationContext) { WebServer webServer = ((WebServerApplicationContext) applicationContext) .getWebServer(); if (webServer instanceof TomcatWebServer) { Context context = findContext((TomcatWebServer) webServer); return context.getManager(); } } return null; }
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sid = ServletRequestUtils.getStringParameter(request, "sid"); String attrName = ServletRequestUtils.getStringParameter(request, "attr"); Session session = context.getManager().findSession(sid); if (session != null) { session.getSession().removeAttribute(attrName); } return new ModelAndView(new RedirectView( request.getContextPath() + getViewName() + "?" + request.getQueryString())); }
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { String sessionId = ServletRequestUtils.getStringParameter(request, "sid"); Session session = context.getManager().findSession(sessionId); if (session != null) { session.expire(); } return new ModelAndView(new InternalResourceView(getViewName())); }
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { for (String sidWebApp : ServletRequestUtils.getStringParameters(request, "sid_webapp")) { if (sidWebApp != null) { String[] ss = sidWebApp.split(";"); if (ss.length == 2) { String sessionId = ss[0]; String appName = ss[1]; Context context = getContainerWrapper().getTomcatContainer().findContext(appName); if (context != null) { Manager manager = context.getManager(); Session session = manager.findSession(sessionId); if (session != null && session.isValid()) { session.expire(); } } else { return new ModelAndView("errors/paramerror"); } } else { return new ModelAndView("errors/paramerror"); } } } return new ModelAndView(new InternalResourceView(getViewName())); }
@Override protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request, HttpServletResponse response) throws Exception { boolean privileged = SecurityUtils.hasAttributeValueRole(getServletContext(), request); boolean calcSize = privileged && ServletRequestUtils.getBooleanParameter(request, "size", false); String sid = ServletRequestUtils.getStringParameter(request, "sid"); ApplicationSession appSession = ApplicationUtils .getApplicationSession(context.getManager().findSession(sid), calcSize, true); if (appSession != null) { appSession.setAllowedToViewValues(privileged); return new ModelAndView(getViewName(), "session", appSession); } return new ModelAndView(getViewName()); }
if (ctx != null && ctx.getManager() != null && (!searchInfo.isApply() || searchInfo.isUseSearch())) { Session[] sessions = ctx.getManager().findSessions(); for (Session session : sessions) { ApplicationSession appSession =
logger.debug("collecting session information"); app.setSessionCount(context.getManager().findSessions().length); long size = 0; for (Session session : context.getManager().findSessions()) { ApplicationSession appSession = getApplicationSession(session, calcSize, false); if (appSession != null) {
private boolean isSessionVersioningSupported() { return context != null && context.getManager() != null && context.getManager().isSessionVersioningSupported(); }
/** * {@inheritDoc} * @see org.jboss.modcluster.Context#getActiveSessionCount() */ public int getActiveSessionCount() { return this.context.getManager().getActiveSessions(); }
/** * {@inheritDoc} * @see org.jboss.modcluster.Context#isDistributable() */ public boolean isDistributable() { return this.context.getManager().getDistributable(); }
protected void logoutSessionIds(List<String> sessionIds) { if (sessionIds == null || sessionIds.isEmpty()) return; Manager sessionManager = request.getContext().getManager(); sessionManagement.logoutHttpSessions(sessionManager, sessionIds); }
private Manager findManager(ApplicationContext applicationContext) { if (applicationContext instanceof EmbeddedWebApplicationContext) { EmbeddedServletContainer container = ((EmbeddedWebApplicationContext) applicationContext).getEmbeddedServletContainer(); if (container instanceof TomcatEmbeddedServletContainer) { Context context = findContext((TomcatEmbeddedServletContainer) container); if (context != null) { return context.getManager(); } } } return null; }