public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession
logger| Constructor and Description |
|---|
AbstractHttpSockJsSession(String id,
SockJsServiceConfig config,
WebSocketHandler wsHandler,
Map<String,Object> handshakeAttributes) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
disconnect(CloseStatus status) |
protected abstract void |
flushCache()
Only called if the connection is currently active
|
String |
getAcceptedProtocol()
Return the selected sub-protocol to use.
|
org.springframework.http.HttpHeaders |
getHandshakeHeaders()
Return the headers used in the handshake request.
|
InetSocketAddress |
getLocalAddress()
Return the address on which the request was received.
|
protected BlockingQueue<String> |
getMessageCache() |
Principal |
getPrincipal()
Return a
Principal instance containing the name of the
authenticated user. |
InetSocketAddress |
getRemoteAddress()
Return the address of the remote client.
|
protected org.springframework.http.server.ServerHttpRequest |
getRequest() |
protected org.springframework.http.server.ServerHttpResponse |
getResponse() |
URI |
getUri()
Return the URI used to open the WebSocket connection.
|
boolean |
isActive()
Polling and Streaming sessions periodically close the current HTTP request and
wait for the next request to come through.
|
protected void |
resetRequest() |
protected void |
sendMessageInternal(String message) |
void |
setAcceptedProtocol(String protocol)
Unlike WebSocket where sub-protocol negotiation is part of the
initial handshake, in HTTP transports the same negotiation must
be emulated and the selected protocol set through this setter.
|
protected void |
setHandshakeHeaders(org.springframework.http.HttpHeaders handshakeHeaders) |
void |
setInitialRequest(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
SockJsFrame.FrameFormat frameFormat) |
protected void |
setLocalAddress(InetSocketAddress localAddress) |
void |
setLongPollingRequest(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
SockJsFrame.FrameFormat frameFormat) |
protected void |
setPrincipal(Principal principal) |
protected void |
setRemoteAddress(InetSocketAddress remoteAddress) |
protected void |
writeFrameInternal(SockJsFrame frame) |
protected void |
writePrelude() |
cancelHeartbeat, close, close, delegateConnectionClosed, delegateConnectionEstablished, delegateError, delegateMessages, getHandshakeAttributes, getId, getSockJsServiceConfig, getTimeSinceLastActive, isClosed, isNew, isOpen, scheduleHeartbeat, sendHeartbeat, sendMessage, toString, tryCloseWithSockJsTransportError, updateLastActiveTime, writeFramepublic AbstractHttpSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler wsHandler, Map<String,Object> handshakeAttributes)
public URI getUri()
WebSocketSessionpublic org.springframework.http.HttpHeaders getHandshakeHeaders()
WebSocketSessionprotected void setHandshakeHeaders(org.springframework.http.HttpHeaders handshakeHeaders)
public Principal getPrincipal()
WebSocketSessionPrincipal instance containing the name of the
authenticated user. If the user has not been authenticated, the method returns
null.protected void setPrincipal(Principal principal)
public InetSocketAddress getLocalAddress()
WebSocketSessionprotected void setLocalAddress(InetSocketAddress localAddress)
public InetSocketAddress getRemoteAddress()
WebSocketSessionprotected void setRemoteAddress(InetSocketAddress remoteAddress)
public void setAcceptedProtocol(String protocol)
protocol - the sub-protocol to setpublic String getAcceptedProtocol()
public void setInitialRequest(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
SockJsFrame.FrameFormat frameFormat)
throws SockJsException
SockJsExceptionprotected void writePrelude()
throws IOException
IOExceptionpublic void setLongPollingRequest(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
SockJsFrame.FrameFormat frameFormat)
throws SockJsException
SockJsExceptionpublic boolean isActive()
AbstractSockJsSessionisActive in class AbstractSockJsSessionprotected BlockingQueue<String> getMessageCache()
protected org.springframework.http.server.ServerHttpRequest getRequest()
protected org.springframework.http.server.ServerHttpResponse getResponse()
protected final void sendMessageInternal(String message) throws SockJsTransportFailureException
sendMessageInternal in class AbstractSockJsSessionSockJsTransportFailureExceptionprotected abstract void flushCache()
throws SockJsTransportFailureException
SockJsTransportFailureExceptionprotected void disconnect(CloseStatus status)
disconnect in class AbstractSockJsSessionprotected void resetRequest()
protected void writeFrameInternal(SockJsFrame frame) throws IOException
writeFrameInternal in class AbstractSockJsSessionIOException