Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 422837 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/service/LifeCycleServiceHandler.java (+5 lines)
Lines 108-113 Link Here
108
      writeInvalidContentType( response );
108
      writeInvalidContentType( response );
109
    } else if( isSessionShutdown() ) {
109
    } else if( isSessionShutdown() ) {
110
      shutdownUISession();
110
      shutdownUISession();
111
      writeEmptyMessage( response );
111
    } else if( isSessionTimeout() ) {
112
    } else if( isSessionTimeout() ) {
112
      writeSessionTimeoutError( response );
113
      writeSessionTimeoutError( response );
113
    } else if( !isRequestCounterValid() ) {
114
    } else if( !isRequestCounterValid() ) {
Lines 251-256 Link Here
251
    response.setCharacterEncoding( HTTP.CHARSET_UTF_8 );
252
    response.setCharacterEncoding( HTTP.CHARSET_UTF_8 );
252
  }
253
  }
253
254
255
  private static void writeEmptyMessage( ServletResponse response ) throws IOException {
256
    new ProtocolMessageWriter().createMessage().writeTo( response.getWriter() );
257
  }
258
254
  private static void writeProtocolMessage( ServletResponse response ) throws IOException {
259
  private static void writeProtocolMessage( ServletResponse response ) throws IOException {
255
    JsonObject message = getProtocolWriter().createMessage();
260
    JsonObject message = getProtocolWriter().createMessage();
256
    bufferProtocolMessage( message );
261
    bufferProtocolMessage( message );
(-)a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/internal/service/LifeCycleServiceHandler_Test.java (+14 lines)
Lines 14-19 Link Here
14
import static org.eclipse.rap.rwt.internal.service.ContextProvider.getApplicationContext;
14
import static org.eclipse.rap.rwt.internal.service.ContextProvider.getApplicationContext;
15
import static org.junit.Assert.assertEquals;
15
import static org.junit.Assert.assertEquals;
16
import static org.junit.Assert.assertFalse;
16
import static org.junit.Assert.assertFalse;
17
import static org.junit.Assert.assertNotNull;
17
import static org.junit.Assert.assertNotSame;
18
import static org.junit.Assert.assertNotSame;
18
import static org.junit.Assert.assertNull;
19
import static org.junit.Assert.assertNull;
19
import static org.junit.Assert.assertSame;
20
import static org.junit.Assert.assertSame;
Lines 137-142 Link Here
137
  }
138
  }
138
139
139
  @Test
140
  @Test
141
  public void testShutdownUISession_returnsValidJson() throws IOException {
142
    LifeCycleServiceHandler.markSessionStarted();
143
    simulateShutdownUiRequest();
144
    service( handler );
145
146
    TestResponse response = getResponse();
147
    JsonObject message = JsonObject.readFrom( response.getContent() );
148
    assertEquals( "application/json; charset=UTF-8", response.getHeader( "Content-Type" ) );
149
    assertNotNull( message.get( ClientMessage.PROP_HEAD ) );
150
    assertNotNull( message.get( ClientMessage.PROP_OPERATIONS ) );
151
  }
152
153
  @Test
140
  public void testShutdownUISession_RemoveUISessionFromHttpSession() throws IOException {
154
  public void testShutdownUISession_RemoveUISessionFromHttpSession() throws IOException {
141
    UISession uiSession = ContextProvider.getUISession();
155
    UISession uiSession = ContextProvider.getUISession();
142
    HttpSession httpSession = uiSession.getHttpSession();
156
    HttpSession httpSession = uiSession.getHttpSession();

Return to bug 422837