@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)); } }
@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()); }
protected void logoutSession(Manager manager, String httpSessionId) { log.debug("logoutHttpSession: " + httpSessionId); Session session; try { session = manager.findSession(httpSessionId); } catch (IOException ioe) { log.warn("IO exception when looking for session " + httpSessionId, ioe); return; } logoutSession(session); }
protected void logoutSession(Manager manager, String httpSessionId) { log.debug("logoutHttpSession: " + httpSessionId); Session session; try { session = manager.findSession(httpSessionId); } catch (IOException ioe) { log.warn("IO exception when looking for session " + httpSessionId, ioe); return; } logoutSession(session); }
private Session getSession(ServletRequest request) { javax.servlet.http.HttpServletRequest httpReq = (javax.servlet.http.HttpServletRequest) request; javax.servlet.http.HttpSession httpSess = httpReq.getSession(false); if(httpSess == null) { return null; } String id = httpSess.getId(); Manager mgr = _context.getManager(); Session sess = null; try { sess = mgr.findSession(id); } catch (java.io.IOException ex) {} return sess; }
/* */ public boolean isRequestedSessionIdValid() /* */ { /* 2130 */ if (this.requestedSessionId == null) /* 2131 */ return false; /* 2132 */ if (this.context == null) /* 2133 */ return false; /* 2134 */ Manager manager = this.context.getManager(); /* 2135 */ if (manager == null) /* 2136 */ return false; /* 2137 */ Session session = null; /* */ try { /* 2139 */ session = manager.findSession(this.requestedSessionId); /* */ } catch (IOException e) { /* 2141 */ session = null; /* */ } /* */ /* 2144 */ return (session != null) && (session.isValid()); /* */ } /* */
public HttpSession getHttpSession(String sessId) { Manager mgr = context.getManager(); if (mgr != null) { try { Session sess = mgr.findSession(sessId); if (sess != null) { return sess.getSession(); } } catch (IOException ignored) { } } return null; }
/** * Return <code>true</code> if the session identifier included in this * request identifies a valid session. */ public boolean isRequestedSessionIdValid() { if (requestedSessionId == null) return (false); if (context == null) return (false); Manager manager = context.getManager(); if (manager == null) return (false); Session session = null; try { session = manager.findSession(requestedSessionId); } catch (IOException e) { session = null; } if ((session != null) && session.isValid()) return (true); else return (false); }
static Session getSession(Request request, boolean create) { HttpServletRequest hreq = (HttpServletRequest)request.getRequest(); HttpSession hses = hreq.getSession(create); if (hses == null) return null; Manager manager = request.getContext().getManager(); if (manager == null) return null; try { return manager.findSession(hses.getId()); } catch (IOException e) { Log.getLogger(LogCategories.SECURITY).error("Error in TomcatValve getting session id " + hses.getId() + " : " + ExceptionUtil.toString(e)); return null; } }
static Session getSession(Request request, boolean create) { HttpServletRequest hreq = (HttpServletRequest)request.getRequest(); HttpSession hses = hreq.getSession(create); if (hses == null) return null; Manager manager = request.getContext().getManager(); if (manager == null) return null; try { return manager.findSession(hses.getId()); } catch (IOException e) { Log.getLogger(LogCategories.SECURITY).error("Error in TomcatValve getting session id " + hses.getId() + " : " + ExceptionUtil.toString(e)); return null; } }
/** * Return <code>true</code> if the session identifier specified * identifies a valid session. */ public boolean isSessionIdValid(Request request, String id) { if (id == null) return (false); Context context = request.getContext(); if (context == null) return (false); Manager manager = context.getManager(); if (manager == null) return (false); Session session = null; try { session = manager.findSession(id); } catch (IOException e) { session = null; } if ((session != null) && session.isValidInternal()) return (true); else return (false); }
protected Session getSessionForNameAndId(ContextName cn, String id, StringManager smClient) throws IOException { if ((cn == null) || !(cn.getPath().startsWith("/") || cn.getPath().equals(""))) { String path = null; if (cn != null) { path = cn.getPath(); } throw new IllegalArgumentException(smClient.getString( "managerServlet.invalidPath", RequestUtil.filter(path))); } Context ctxt = (Context) host.findChild(cn.getName()); if (null == ctxt) { throw new IllegalArgumentException(smClient.getString( "managerServlet.noContext", RequestUtil.filter(cn.getDisplayName()))); } Session session = ctxt.getManager().findSession(id); return session; }
protected Session getSessionForNameAndId(ContextName cn, String id, StringManager smClient) throws IOException { if ((cn == null) || !(cn.getPath().startsWith("/") || cn.getPath().equals(""))) { String path = null; if (cn != null) { path = cn.getPath(); } throw new IllegalArgumentException(smClient.getString( "managerServlet.invalidPath", RequestUtil.filter(path))); } Context ctxt = (Context) host.findChild(cn.getName()); if (null == ctxt) { throw new IllegalArgumentException(smClient.getString( "managerServlet.noContext", RequestUtil.filter(cn.getDisplayName()))); } Session session = ctxt.getManager().findSession(id); return session; }
@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)); } }