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 (+9 lines)
Lines 24-29 Link Here
24
import javax.servlet.http.HttpServletRequest;
24
import javax.servlet.http.HttpServletRequest;
25
import javax.servlet.http.HttpServletResponse;
25
import javax.servlet.http.HttpServletResponse;
26
26
27
import org.eclipse.rap.json.JsonArray;
27
import org.eclipse.rap.json.JsonObject;
28
import org.eclipse.rap.json.JsonObject;
28
import org.eclipse.rap.json.JsonValue;
29
import org.eclipse.rap.json.JsonValue;
29
import org.eclipse.rap.rwt.RWT;
30
import org.eclipse.rap.rwt.RWT;
Lines 108-113 Link Here
108
      writeInvalidContentType( response );
109
      writeInvalidContentType( response );
109
    } else if( isSessionShutdown() ) {
110
    } else if( isSessionShutdown() ) {
110
      shutdownUISession();
111
      shutdownUISession();
112
      writeEmptyMessage( response );
111
    } else if( isSessionTimeout() ) {
113
    } else if( isSessionTimeout() ) {
112
      writeSessionTimeoutError( response );
114
      writeSessionTimeoutError( response );
113
    } else if( !isRequestCounterValid() ) {
115
    } else if( !isRequestCounterValid() ) {
Lines 251-256 Link Here
251
    response.setCharacterEncoding( HTTP.CHARSET_UTF_8 );
253
    response.setCharacterEncoding( HTTP.CHARSET_UTF_8 );
252
  }
254
  }
253
255
256
  private static void writeEmptyMessage( ServletResponse response ) throws IOException {
257
    JsonObject message = new JsonObject();
258
    message.add( ClientMessage.PROP_HEAD, new JsonObject() );
259
    message.add( ClientMessage.PROP_OPERATIONS, new JsonArray() );
260
    message.writeTo( response.getWriter() );
261
  }
262
254
  private static void writeProtocolMessage( ServletResponse response ) throws IOException {
263
  private static void writeProtocolMessage( ServletResponse response ) throws IOException {
255
    JsonObject message = getProtocolWriter().createMessage();
264
    JsonObject message = getProtocolWriter().createMessage();
256
    bufferProtocolMessage( message );
265
    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