Esempio n. 1
0
  @Test
  public void testDoFilter_attachesHttpSessionToUISession() throws Exception {
    UISessionImpl deserializedUISession = new UISessionImpl(null, null);
    HttpSession httpSession = mockHttpSession();
    setUISession(httpSession, deserializedUISession);
    request.setSession(httpSession);

    rwtClusterSupport.doFilter(request, response, chain);

    assertSame(httpSession, deserializedUISession.getHttpSession());
  }
Esempio n. 2
0
  @Test
  public void testDoFilter_attachesApplicationContextToUISession() throws Exception {
    ApplicationContextImpl applicationContext = mock(ApplicationContextImpl.class);
    HttpSession httpSession = mockHttpSession(mockServletContext(applicationContext));
    request.setSession(httpSession);
    UISessionImpl deserializedUISession = new UISessionImpl(null, httpSession);
    setUISession(httpSession, deserializedUISession);

    rwtClusterSupport.doFilter(request, response, chain);

    assertSame(applicationContext, deserializedUISession.getApplicationContext());
  }
Esempio n. 3
0
 private static void setUISession(HttpSession httpSession, UISessionImpl uiSession) {
   String attributeName = ATTR_UI_SESSION;
   String connectionId = uiSession.getConnectionId();
   if (connectionId != null) {
     attributeName += connectionId;
   }
   when(httpSession.getAttribute(eq(attributeName))).thenReturn(uiSession);
 }
Esempio n. 4
0
 private static void prepareUISession(ServiceContext context) {
   HttpServletRequest request = context.getRequest();
   HttpSession httpSession = request.getSession(true);
   String connectionId = request.getParameter(CONNECTION_ID);
   if (connectionId != null) {
     context.setUISession(UISessionImpl.getInstanceFromSession(httpSession, connectionId));
   } else if (isUIRequest(request)) {
     context.setUISession(new UISessionBuilder(context).buildUISession());
   }
 }