@Test public void run() throws URISyntaxException { final HttpRequest req = new HttpRequestImpl(new URI("http: final javax.servlet.http.HttpSession session = req.getSession(); assertNotNull(session); session.invalidate(); assertNull(req.getSession(false)); }
public HttpSession getSession(boolean create) { if (session == null && create) { long timeout = -1; if (contextPath != null) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { for (final AppInfo info : assembler.getDeployedApplications()) { for (final WebAppInfo webApp : info.webApps) { if (webApp.contextRoot.replace("/", "").equals(contextPath.replace("/", ""))) { timeout = webApp.sessionTimeout; } } } } } final HttpSessionImpl impl = new HttpSessionImpl(contextPath, timeout) { @Override public void invalidate() { super.invalidate(); HttpRequestImpl.this.session = null; } }; session = impl; if (begin != null) { begin.sessionCreated(new HttpSessionEvent(session)); session = new SessionInvalidateListener(session, begin); } impl.callListeners(); final SessionManager sessionManager = SystemInstance.get().getComponent(SessionManager.class); final SessionManager.SessionWrapper previous = sessionManager.newSession(begin, end, session, application); if (previous != null) { session = previous.session; } } return session; }
HttpRequestImpl implements HttpRequest { public HttpSession getSession(boolean create) { if (session == null && create) { long timeout = -1; if (contextPath != null) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { for (final AppInfo info : assembler.getDeployedApplications()) { for (final WebAppInfo webApp : info.webApps) { if (webApp.contextRoot.replace("/", "").equals(contextPath.replace("/", ""))) { timeout = webApp.sessionTimeout; } } } } } final HttpSessionImpl impl = new HttpSessionImpl(contextPath, timeout) { @Override public void invalidate() { super.invalidate(); HttpRequestImpl.this.session = null; } }; session = impl; if (begin != null) { begin.sessionCreated(new HttpSessionEvent(session)); session = new SessionInvalidateListener(session, begin); } impl.callListeners(); final SessionManager sessionManager = SystemInstance.get().getComponent(SessionManager.class); final SessionManager.SessionWrapper previous = sessionManager.newSession(begin, end, session, application); if (previous != null) { session = previous.session; } } return session; } }
HttpRequestImpl implements HttpRequest { public HttpSession getSession(boolean create) { if (session == null && create) { long timeout = -1; if (contextPath != null) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { for (final AppInfo info : assembler.getDeployedApplications()) { for (final WebAppInfo webApp : info.webApps) { if (webApp.contextRoot.replace("/", "").equals(contextPath.replace("/", ""))) { timeout = webApp.sessionTimeout; } } } } } final HttpSessionImpl impl = new HttpSessionImpl(contextPath, timeout) { @Override public void invalidate() { super.invalidate(); HttpRequestImpl.this.session = null; } }; session = impl; if (begin != null) { begin.sessionCreated(new HttpSessionEvent(session)); session = new SessionInvalidateListener(session, begin); } impl.callListeners(); final SessionManager sessionManager = SystemInstance.get().getComponent(SessionManager.class); final SessionManager.SessionWrapper previous = sessionManager.newSession(begin, end, session, application); if (previous != null) { session = previous.session; } } return session; } HttpRequestImpl(URI socketURI); }
HttpRequestImpl implements HttpRequest { public HttpSession getSession(boolean create) { if (session == null && create) { long timeout = -1; if (contextPath != null) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { for (final AppInfo info : assembler.getDeployedApplications()) { for (final WebAppInfo webApp : info.webApps) { if (webApp.contextRoot.replace("/", "").equals(contextPath.replace("/", ""))) { timeout = webApp.sessionTimeout; } } } } } final HttpSessionImpl impl = new HttpSessionImpl(contextPath, timeout) { @Override public void invalidate() { super.invalidate(); HttpRequestImpl.this.session = null; } }; session = impl; if (begin != null) { begin.sessionCreated(new HttpSessionEvent(session)); session = new SessionInvalidateListener(session, begin); } impl.callListeners(); final SessionManager sessionManager = SystemInstance.get().getComponent(SessionManager.class); final SessionManager.SessionWrapper previous = sessionManager.newSession(begin, end, session, application); if (previous != null) { session = previous.session; } } return session; } HttpRequestImpl(URI socketURI); void setUri(final URI uri); String getHeader(String name); @Override Enumeration<String> getHeaderNames(); @Override Enumeration<String> getHeaders(String s); @Override int getIntHeader(final String s); String getFormParameter(String name); Map<String, String> getFormParameters(); String getMethod(); @Override Part getPart(String s); @Override T upgrade(final Class<T> httpUpgradeHandlerClass); @Override Collection<Part> getParts(); void noPathInfo(); @Override String getPathInfo(); @Override String getPathTranslated(); @Override String getQueryString(); @Override String getRemoteUser(); @Override String getRequestedSessionId(); @Override String getRequestURI(); @Override StringBuffer getRequestURL(); @Override String getServletPath(); void initServletPath(final String servlet); void addQueryParams(final String query); URI getURI(); int getContentLength(); @Override long getContentLengthLong(); String getContentType(); @Override DispatcherType getDispatcherType(); ServletInputStream getInputStream(); @Override String getLocalAddr(); @Override Locale getLocale(); @Override Enumeration<Locale> getLocales(); @Override String getLocalName(); @Override int getLocalPort(); void print(final Logger log, boolean formatXml); void parseURI(StringTokenizer lineParts); @Override boolean authenticate(HttpServletResponse httpServletResponse); @Override String getAuthType(); @Override String getContextPath(); String extractContextPath(); @Override Cookie[] getCookies(); @Override long getDateHeader(String s); HttpSession getSession(boolean create); @Override Principal getUserPrincipal(); @Override boolean isRequestedSessionIdFromCookie(); @Override boolean isRequestedSessionIdFromUrl(); @Override boolean isRequestedSessionIdFromURL(); @Override boolean isRequestedSessionIdValid(); @Override boolean isUserInRole(final String s); @Override void login(final String s, final String s1); @Override void logout(); HttpSession getSession(); @Override String changeSessionId(); @Override AsyncContext getAsyncContext(); Object getAttribute(String name); @Override Enumeration<String> getAttributeNames(); @Override String getCharacterEncoding(); void setAttribute(String name, Object value); @Override void setCharacterEncoding(String s); @Override AsyncContext startAsync(); @Override // avoids the need of org.apache.openejb.server.httpd.EEFilter in embedded mode AsyncContext startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse); void addInternalParameter(final String key, final String val); String getParameter(String name); @Override Map<String, String[]> getParameterMap(); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(final String s); @Override String getProtocol(); @Override BufferedReader getReader(); @Override String getRealPath(String s); @Deprecated // TODO should be dropped, do we drop axis module as well? Map<String, String> getParameters(); String getRemoteAddr(); @Override String getRemoteHost(); @Override int getRemotePort(); @Override RequestDispatcher getRequestDispatcher(String s); @Override String getScheme(); @Override String getServerName(); @Override int getServerPort(); @Override ServletContext getServletContext(); @Override boolean isAsyncStarted(); @Override boolean isAsyncSupported(); @Override boolean isSecure(); @Override void removeAttribute(String s); void setPath(final String path); String requestRawPath(); void initPathFromContext(final String context); void setEndListener(final EndWebBeansListener end); void setApplication(final WebContext app); void setBeginListener(final BeginWebBeansListener begin); void init(); void destroy(); }
HttpRequestImpl implements HttpRequest { public HttpSession getSession(boolean create) { if (session == null && create) { long timeout = -1; if (contextPath != null) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { for (final AppInfo info : assembler.getDeployedApplications()) { for (final WebAppInfo webApp : info.webApps) { if (webApp.contextRoot.replace("/", "").equals(contextPath.replace("/", ""))) { timeout = webApp.sessionTimeout; } } } } } final HttpSessionImpl impl = new HttpSessionImpl(contextPath, timeout) { @Override public void invalidate() { super.invalidate(); HttpRequestImpl.this.session = null; } }; session = impl; if (begin != null) { begin.sessionCreated(new HttpSessionEvent(session)); session = new SessionInvalidateListener(session, begin); } impl.callListeners(); final SessionManager sessionManager = SystemInstance.get().getComponent(SessionManager.class); final SessionManager.SessionWrapper previous = sessionManager.newSession(begin, end, session, application); if (previous != null) { session = previous.session; } } return session; } HttpRequestImpl(URI socketURI); void setUri(final URI uri); String getHeader(String name); @Override Enumeration<String> getHeaderNames(); @Override Enumeration<String> getHeaders(String s); @Override int getIntHeader(final String s); String getFormParameter(String name); Map<String, String> getFormParameters(); String getMethod(); @Override Part getPart(String s); @Override T upgrade(final Class<T> httpUpgradeHandlerClass); @Override Collection<Part> getParts(); void noPathInfo(); @Override String getPathInfo(); @Override String getPathTranslated(); @Override String getQueryString(); @Override String getRemoteUser(); @Override String getRequestedSessionId(); @Override String getRequestURI(); @Override StringBuffer getRequestURL(); @Override String getServletPath(); void initServletPath(final String servlet); void addQueryParams(final String query); URI getURI(); int getContentLength(); @Override long getContentLengthLong(); String getContentType(); @Override DispatcherType getDispatcherType(); ServletInputStream getInputStream(); @Override String getLocalAddr(); @Override Locale getLocale(); @Override Enumeration<Locale> getLocales(); @Override String getLocalName(); @Override int getLocalPort(); void print(final Logger log, boolean formatXml); void parseURI(StringTokenizer lineParts); @Override boolean authenticate(HttpServletResponse httpServletResponse); @Override String getAuthType(); @Override String getContextPath(); String extractContextPath(); @Override Cookie[] getCookies(); @Override long getDateHeader(String s); HttpSession getSession(boolean create); @Override Principal getUserPrincipal(); @Override boolean isRequestedSessionIdFromCookie(); @Override boolean isRequestedSessionIdFromUrl(); @Override boolean isRequestedSessionIdFromURL(); @Override boolean isRequestedSessionIdValid(); @Override boolean isUserInRole(final String s); @Override void login(final String s, final String s1); @Override void logout(); HttpSession getSession(); @Override String changeSessionId(); @Override AsyncContext getAsyncContext(); Object getAttribute(String name); @Override Enumeration<String> getAttributeNames(); @Override String getCharacterEncoding(); void setAttribute(String name, Object value); @Override void setCharacterEncoding(String s); @Override AsyncContext startAsync(); @Override // avoids the need of org.apache.openejb.server.httpd.EEFilter in embedded mode AsyncContext startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse); void addInternalParameter(final String key, final String val); String getParameter(String name); @Override Map<String, String[]> getParameterMap(); @Override Enumeration<String> getParameterNames(); @Override String[] getParameterValues(final String s); @Override String getProtocol(); @Override BufferedReader getReader(); @Override String getRealPath(String s); @Deprecated // TODO should be dropped, do we drop axis module as well? Map<String, String> getParameters(); String getRemoteAddr(); @Override String getRemoteHost(); @Override int getRemotePort(); @Override RequestDispatcher getRequestDispatcher(String s); @Override String getScheme(); @Override String getServerName(); @Override int getServerPort(); @Override ServletContext getServletContext(); @Override boolean isAsyncStarted(); @Override boolean isAsyncSupported(); @Override boolean isSecure(); @Override void removeAttribute(String s); void setPath(final String path); String requestRawPath(); void initPathFromContext(final String context); void setEndListener(final EndWebBeansListener end); void setApplication(final WebContext app); void setBeginListener(final BeginWebBeansListener begin); void init(); void destroy(); static final Class<?>[] SERVLET_CONTEXT_INTERFACES; static final InvocationHandler SERVLET_CONTEXT_HANDLER; }