Rename SockJS session type to include "SockJs"
This commit is contained in:
@@ -35,14 +35,14 @@ import org.springframework.util.Assert;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractServerSession extends SockJsSessionSupport {
|
||||
public abstract class AbstractServerSockJsSession extends SockJsSessionSupport {
|
||||
|
||||
private final SockJsConfiguration sockJsConfig;
|
||||
|
||||
private ScheduledFuture<?> heartbeatTask;
|
||||
|
||||
|
||||
public AbstractServerSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
public AbstractServerSockJsSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
super(sessionId, sockJsHandler);
|
||||
this.sockJsConfig = sockJsConfig;
|
||||
}
|
||||
@@ -66,12 +66,12 @@ public abstract class AbstractHttpSendingTransportHandler
|
||||
// Set content type before writing
|
||||
response.getHeaders().setContentType(getContentType());
|
||||
|
||||
AbstractHttpServerSession httpServerSession = (AbstractHttpServerSession) session;
|
||||
AbstractHttpServerSockJsSession httpServerSession = (AbstractHttpServerSockJsSession) session;
|
||||
handleRequestInternal(request, response, httpServerSession);
|
||||
}
|
||||
|
||||
protected void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession httpServerSession) throws Exception, IOException {
|
||||
AbstractHttpServerSockJsSession httpServerSession) throws Exception, IOException {
|
||||
|
||||
if (httpServerSession.isNew()) {
|
||||
handleNewSession(request, response, httpServerSession);
|
||||
@@ -87,7 +87,7 @@ public abstract class AbstractHttpSendingTransportHandler
|
||||
}
|
||||
|
||||
protected void handleNewSession(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession session) throws Exception {
|
||||
AbstractHttpServerSockJsSession session) throws Exception {
|
||||
|
||||
logger.debug("Opening " + getTransportType() + " connection");
|
||||
session.setFrameFormat(getFrameFormat(request));
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.http.server.AsyncServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.sockjs.SockJsHandler;
|
||||
import org.springframework.sockjs.server.AbstractServerSession;
|
||||
import org.springframework.sockjs.server.AbstractServerSockJsSession;
|
||||
import org.springframework.sockjs.server.SockJsConfiguration;
|
||||
import org.springframework.sockjs.server.SockJsFrame;
|
||||
import org.springframework.sockjs.server.SockJsFrame.FrameFormat;
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractHttpServerSession extends AbstractServerSession {
|
||||
public abstract class AbstractHttpServerSockJsSession extends AbstractServerSockJsSession {
|
||||
|
||||
private FrameFormat frameFormat;
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractHttpServerSession extends AbstractServerSession {
|
||||
private ServerHttpResponse response;
|
||||
|
||||
|
||||
public AbstractHttpServerSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
public AbstractHttpServerSockJsSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
super(sessionId, sockJsConfig, sockJsHandler);
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ public abstract class AbstractStreamingTransportHandler extends AbstractHttpSend
|
||||
|
||||
|
||||
@Override
|
||||
public StreamingHttpServerSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
public StreamingServerSockJsSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
Assert.notNull(getSockJsConfig(), "This transport requires SockJsConfiguration");
|
||||
return new StreamingHttpServerSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
return new StreamingServerSockJsSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession session) throws Exception {
|
||||
AbstractHttpServerSockJsSession session) throws Exception {
|
||||
|
||||
writePrelude(request, response);
|
||||
super.handleRequestInternal(request, response, session);
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractStreamingTransportHandler extends AbstractHttpSend
|
||||
|
||||
@Override
|
||||
protected void handleNewSession(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession session) throws IOException, Exception {
|
||||
AbstractHttpServerSockJsSession session) throws IOException, Exception {
|
||||
|
||||
super.handleNewSession(request, response, session);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class HtmlFileTransportHandler extends AbstractStreamingTransportHandler
|
||||
|
||||
@Override
|
||||
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession session) throws Exception {
|
||||
AbstractHttpServerSockJsSession session) throws Exception {
|
||||
|
||||
String callback = request.getQueryParams().getFirst("c");
|
||||
if (! StringUtils.hasText(callback)) {
|
||||
|
||||
@@ -50,14 +50,14 @@ public class JsonpPollingTransportHandler extends AbstractHttpSendingTransportHa
|
||||
}
|
||||
|
||||
@Override
|
||||
public PollingHttpServerSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
public PollingServerSockJsSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
Assert.notNull(getSockJsConfig(), "This transport requires SockJsConfiguration");
|
||||
return new PollingHttpServerSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
return new PollingServerSockJsSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response,
|
||||
AbstractHttpServerSession session) throws Exception {
|
||||
AbstractHttpServerSockJsSession session) throws Exception {
|
||||
|
||||
String callback = request.getQueryParams().getFirst("c");
|
||||
if (! StringUtils.hasText(callback)) {
|
||||
|
||||
@@ -22,9 +22,9 @@ import org.springframework.sockjs.server.SockJsConfiguration;
|
||||
import org.springframework.sockjs.server.SockJsFrame;
|
||||
|
||||
|
||||
public class PollingHttpServerSession extends AbstractHttpServerSession {
|
||||
public class PollingServerSockJsSession extends AbstractHttpServerSockJsSession {
|
||||
|
||||
public PollingHttpServerSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
public PollingServerSockJsSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
super(sessionId, sockJsConfig, sockJsHandler);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.sockjs.SockJsHandler;
|
||||
import org.springframework.sockjs.SockJsSessionSupport;
|
||||
import org.springframework.sockjs.server.AbstractServerSession;
|
||||
import org.springframework.sockjs.server.AbstractServerSockJsSession;
|
||||
import org.springframework.sockjs.server.SockJsConfiguration;
|
||||
import org.springframework.sockjs.server.SockJsFrame;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -82,7 +82,7 @@ public class SockJsWebSocketHandler implements WebSocketHandler {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("New session: " + wsSession);
|
||||
}
|
||||
SockJsSessionSupport session = new WebSocketServerSession(wsSession, getSockJsConfig());
|
||||
SockJsSessionSupport session = new WebSocketServerSockJsSession(wsSession, getSockJsConfig());
|
||||
this.sessions.put(wsSession, session);
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ public class SockJsWebSocketHandler implements WebSocketHandler {
|
||||
}
|
||||
|
||||
|
||||
private class WebSocketServerSession extends AbstractServerSession {
|
||||
private class WebSocketServerSockJsSession extends AbstractServerSockJsSession {
|
||||
|
||||
private WebSocketSession webSocketSession;
|
||||
|
||||
|
||||
public WebSocketServerSession(WebSocketSession wsSession, SockJsConfiguration sockJsConfig) throws Exception {
|
||||
public WebSocketServerSockJsSession(WebSocketSession wsSession, SockJsConfiguration sockJsConfig) throws Exception {
|
||||
super(String.valueOf(wsSession.hashCode()), sockJsConfig, getSockJsHandler());
|
||||
this.webSocketSession = wsSession;
|
||||
this.webSocketSession.sendText(SockJsFrame.openFrame().getContent());
|
||||
|
||||
@@ -23,12 +23,12 @@ import org.springframework.sockjs.server.SockJsConfiguration;
|
||||
import org.springframework.sockjs.server.SockJsFrame;
|
||||
|
||||
|
||||
public class StreamingHttpServerSession extends AbstractHttpServerSession {
|
||||
public class StreamingServerSockJsSession extends AbstractHttpServerSockJsSession {
|
||||
|
||||
private int byteCount;
|
||||
|
||||
|
||||
public StreamingHttpServerSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
public StreamingServerSockJsSession(String sessionId, SockJsConfiguration sockJsConfig, SockJsHandler sockJsHandler) {
|
||||
super(sessionId, sockJsConfig, sockJsHandler);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class WebSocketSockJsHandlerAdapter implements WebSocketHandler {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("New session: " + wsSession);
|
||||
}
|
||||
SockJsSessionSupport session = new WebSocketSessionAdapter(wsSession);
|
||||
SockJsSessionSupport session = new SockJsWebSocketSessionAdapter(wsSession);
|
||||
this.sessions.put(wsSession, session);
|
||||
}
|
||||
|
||||
@@ -108,12 +108,12 @@ public class WebSocketSockJsHandlerAdapter implements WebSocketHandler {
|
||||
}
|
||||
|
||||
|
||||
private class WebSocketSessionAdapter extends SockJsSessionSupport {
|
||||
private class SockJsWebSocketSessionAdapter extends SockJsSessionSupport {
|
||||
|
||||
private WebSocketSession wsSession;
|
||||
|
||||
|
||||
public WebSocketSessionAdapter(WebSocketSession wsSession) throws Exception {
|
||||
public SockJsWebSocketSessionAdapter(WebSocketSession wsSession) throws Exception {
|
||||
super(String.valueOf(wsSession.hashCode()), getSockJsHandler());
|
||||
this.wsSession = wsSession;
|
||||
connectionInitialized();
|
||||
|
||||
@@ -50,9 +50,9 @@ public class XhrPollingTransportHandler extends AbstractHttpSendingTransportHand
|
||||
return new DefaultFrameFormat("%s\n");
|
||||
}
|
||||
|
||||
public PollingHttpServerSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
public PollingServerSockJsSession createSession(String sessionId, SockJsHandler sockJsHandler) {
|
||||
Assert.notNull(getSockJsConfig(), "This transport requires SockJsConfiguration");
|
||||
return new PollingHttpServerSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
return new PollingServerSockJsSession(sessionId, getSockJsConfig(), sockJsHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user