예제 #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());
  }
예제 #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());
  }
예제 #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);
 }
예제 #4
0
파일: RWTServlet.java 프로젝트: oaperez/rap
 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());
   }
 }