Search in sources :

Example 76 with HttpSession

use of javax.servlet.http.HttpSession in project jodd by oblac.

the class SessionMonitor method sessionDestroyed.

/**
	 * Removes session from a map and broadcasts event to registered listeners.
	 */
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
    HttpSession session = httpSessionEvent.getSession();
    sessionMap.remove(session.getId());
    for (HttpSessionListener listener : listeners) {
        listener.sessionDestroyed(httpSessionEvent);
    }
}
Also used : HttpSessionListener(javax.servlet.http.HttpSessionListener) HttpSession(javax.servlet.http.HttpSession)

Example 77 with HttpSession

use of javax.servlet.http.HttpSession in project spark by perwendel.

the class SessionTest method setup.

@Before
public void setup() {
    httpSession = mock(HttpSession.class);
    request = mock(Request.class);
    session = new Session(httpSession, request);
}
Also used : HttpSession(javax.servlet.http.HttpSession) HttpSession(javax.servlet.http.HttpSession) Before(org.junit.Before)

Example 78 with HttpSession

use of javax.servlet.http.HttpSession in project spark by perwendel.

the class SessionTest method testSession.

@Test
public void testSession() {
    HttpSession internalSession = Whitebox.getInternalState(session, "session");
    assertEquals("Internal session should be set to the http session provided during instantiation", httpSession, internalSession);
}
Also used : HttpSession(javax.servlet.http.HttpSession) Test(org.junit.Test)

Example 79 with HttpSession

use of javax.servlet.http.HttpSession in project spark by perwendel.

the class RequestTest method testSession_2times.

@Test
public void testSession_2times() {
    when(servletRequest.getSession(true)).thenReturn(httpSession);
    Session session = request.session(true);
    session = request.session(true);
    assertNotNull(session);
    verify(servletRequest, times(1)).getSession(true);
}
Also used : HttpSession(javax.servlet.http.HttpSession) Test(org.junit.Test)

Example 80 with HttpSession

use of javax.servlet.http.HttpSession in project spark by perwendel.

the class RequestTest method setup.

@Before
public void setup() {
    servletRequest = mock(HttpServletRequest.class);
    httpSession = mock(HttpSession.class);
    request = new Request(match, servletRequest);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpSession(javax.servlet.http.HttpSession) HttpServletRequest(javax.servlet.http.HttpServletRequest) Before(org.junit.Before)

Aggregations

HttpSession (javax.servlet.http.HttpSession)730 HttpServletRequest (javax.servlet.http.HttpServletRequest)151 Test (org.junit.Test)110 IOException (java.io.IOException)80 HttpServletResponse (javax.servlet.http.HttpServletResponse)80 ServletException (javax.servlet.ServletException)75 ArrayList (java.util.ArrayList)65 RequestDispatcher (javax.servlet.RequestDispatcher)59 HashMap (java.util.HashMap)48 Map (java.util.Map)44 Locale (java.util.Locale)39 Properties (java.util.Properties)39 PrintWriter (java.io.PrintWriter)38 Cookie (javax.servlet.http.Cookie)27 List (java.util.List)24 SQLException (java.sql.SQLException)23 WebUser (org.compiere.util.WebUser)23 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)20 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)20 ModelAndView (org.springframework.web.servlet.ModelAndView)20