Enable cookie_needed by default in SockJS service

Issue: SPR-10939
This commit is contained in:
Rossen Stoyanchev
2013-09-26 12:39:09 -04:00
parent e756ef5923
commit 77fa8698b3
5 changed files with 46 additions and 78 deletions

View File

@@ -149,7 +149,7 @@ public class AbstractSockJsServiceTests extends AbstractHttpRequestTests {
assertEquals(",\"origins\":[\"*:*\"],\"cookie_needed\":false,\"websocket\":true}",
body.substring(body.indexOf(',')));
this.service.setDummySessionCookieEnabled(false);
this.service.setSessionCookieNeeded(false);
this.service.setWebSocketsEnabled(false);
handleRequest("GET", "/a/info", HttpStatus.OK);

View File

@@ -151,40 +151,6 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
assertEquals("OPTIONS, POST", this.response.getHeaders().getFirst("Access-Control-Allow-Methods"));
}
@Test
public void dummySessionCookieEnabled() throws Exception {
setRequest("POST", sessionUrlPrefix + "xhr");
this.service.setDummySessionCookieEnabled(true);
this.service.handleRequest(this.request, this.response, this.wsHandler);
this.response.flush();
assertEquals(200, this.servletResponse.getStatus());
assertEquals("JSESSIONID=dummy;path=/", this.servletResponse.getHeader("Set-Cookie"));
}
@Test
public void dummySessionCookieDisabled() throws Exception {
setRequest("POST", sessionUrlPrefix + "xhr");
this.service.setDummySessionCookieEnabled(false);
this.service.handleTransportRequest(this.request, this.response, this.wsHandler, sessionId, "xhr");
assertEquals(200, this.servletResponse.getStatus());
assertNull(this.servletResponse.getHeader("Set-Cookie"));
}
@Test
public void dummySessionCookieReuseRequestCookieValue() throws Exception {
setRequest("POST", sessionUrlPrefix + "xhr");
this.servletRequest.addHeader("Cookie", "JSESSIONID=123456789");
this.service.handleTransportRequest(this.request, this.response, this.wsHandler, sessionId, "xhr");
assertEquals(200, this.servletResponse.getStatus());
assertNull(this.servletResponse.getHeader("Set-Cookie"));
}
@Test
public void handleTransportRequestNoSuitableHandler() throws Exception {