@Test public void doFilterSessionContext() throws Exception { doFilter(new DoInFilter() { @Override public void doFilter(HttpServletRequest wrappedRequest) { HttpSessionContext sessionContext = wrappedRequest.getSession() .getSessionContext(); assertThat(sessionContext).isNotNull(); assertThat(sessionContext.getSession("a")).isNull(); assertThat(sessionContext.getIds()).isNotNull(); assertThat(sessionContext.getIds().hasMoreElements()).isFalse(); try { sessionContext.getIds().nextElement(); fail("Expected Exception"); } catch (NoSuchElementException ignored) { } } }); }
@Override public HttpSessionContext getSessionContext() { touch(); final SessionManager component = SystemInstance.get().getComponent(SessionManager.class); return new HttpSessionContext() { @Override public javax.servlet.http.HttpSession getSession(final String sessionId) { final HttpSessionEvent event = component.findSession(sessionId); return event == null ? null : event.getSession(); } @Override public Enumeration<String> getIds() { return Collections.enumeration(component.findSessionIds()); } }; }
/** * Return the session context with which this session is associated. * * @deprecated As of Version 2.1, this method is deprecated and has no * replacement. It will be removed in a future version of the * Java Servlet API. */ public HttpSessionContext getSessionContext() { if (sessionContext == null) sessionContext = new StandardSessionContext(); return (sessionContext); }
AcmeSession(String id, int inactiveInterval, ServletContext servletContext, HttpSessionContext sessionContext) { // new // Exception("Session created with: "+servletContext).printStackTrace(); // //!!! createTime = System.currentTimeMillis(); this.id = id; this.inactiveInterval = inactiveInterval; this.servletContext = servletContext; this.sessionContext = sessionContext; }
@Override public HttpSessionContext getSessionContext() { return new HttpSessionContext() { @Override public HttpSession getSession(String s) { return HttpSessionMock.this; } @Override public Enumeration<String> getIds() { return new Enumeration<String>() { private boolean hasNext = true; @Override public boolean hasMoreElements() { return hasNext; } @Override public String nextElement() { hasNext = false; return getId(); } }; } }; }
@Override public HttpSessionContext getSessionContext() { return null; }
@Override public HttpSessionContext getSessionContext() { throw new RuntimeException("getSessionContext method not finished."); }
@SuppressWarnings("deprecation") @Override public HttpSessionContext getSessionContext() { throw new IllegalStateException("As of Version 2.1, this method is deprecated and has no replacement."); }
public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException(); }
public HttpSessionContext getSessionContext() { return NOOP_SESSION_CONTEXT; }
public HttpSessionContext getSessionContext() { return _delegate.getSessionContext(); }
public HttpSessionContext getSessionContext() { return session.getSessionContext(); }
/** * @deprecated no replacement. **/ public HttpSessionContext getSessionContext() { return null; }
@Override public HttpSessionContext getSessionContext() { return EMPTY_SESSION_CONTEXT; }
/** * @deprecated */ public HttpSessionContext getSessionContext() { return null; }
@Override public HttpSessionContext getSessionContext() { return SessionContext.getSession().getSessionContext(); }
@Override public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException("getSessionContext() is deprecated"); }
@Override public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException("Not Impl."); }
@Override public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException("Deprecated"); }
@Override public HttpSessionContext getSessionContext() { return delegate.getSessionContext(); }
@Override @Deprecated public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException("Session context is deprecated and no longer supported"); }
@Override public HttpSessionContext getSessionContext() { // TODO Auto-generated method stub return null; }
@Deprecated @SuppressWarnings("deprecation") public HttpSessionContext getSessionContext() { return originalSession.getSessionContext(); }
@Override public HttpSessionContext getSessionContext() { throw new UnsupportedOperationException(); }
@Override public HttpSessionContext getSessionContext() { return wrapped.getSessionContext(); }
public HttpSessionContext getSessionContext() { return null; }