public abstract class AbstractXhrTransport extends Object implements XhrTransport
| Modifier and Type | Field and Description |
|---|---|
protected Log |
logger |
protected static String |
PRELUDE |
| Constructor and Description |
|---|
AbstractXhrTransport() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.util.concurrent.ListenableFuture<WebSocketSession> |
connect(TransportRequest request,
WebSocketHandler handler)
Connect the transport.
|
protected abstract void |
connectInternal(TransportRequest request,
WebSocketHandler handler,
URI receiveUrl,
org.springframework.http.HttpHeaders handshakeHeaders,
XhrClientSockJsSession session,
org.springframework.util.concurrent.SettableListenableFuture<WebSocketSession> connectFuture) |
String |
executeInfoRequest(URI infoUrl)
Perform an HTTP request to the SockJS "Info" URL.
|
protected abstract org.springframework.http.ResponseEntity<String> |
executeInfoRequestInternal(URI infoUrl) |
void |
executeSendRequest(URI url,
TextMessage message)
Execute a request to send the message to the server.
|
protected abstract org.springframework.http.ResponseEntity<String> |
executeSendRequestInternal(URI url,
org.springframework.http.HttpHeaders headers,
TextMessage message) |
org.springframework.http.HttpHeaders |
getRequestHeaders() |
List<TransportType> |
getTransportTypes()
Return the SockJS transport types that this transport can be used for.
|
boolean |
isXhrStreamingDisabled()
Whether XHR streaming is disabled or not.
|
void |
setRequestHeaders(org.springframework.http.HttpHeaders requestHeaders)
Configure headers to be added to every executed HTTP request.
|
void |
setXhrStreamingDisabled(boolean disabled)
An
XhrTransport can support both the "xhr_streaming" and "xhr"
SockJS server transports. |
String |
toString() |
public List<TransportType> getTransportTypes()
TransportXhrTransport could do both.getTransportTypes in interface Transportpublic void setXhrStreamingDisabled(boolean disabled)
XhrTransport can support both the "xhr_streaming" and "xhr"
SockJS server transports. From a client perspective there is no
implementation difference.
Typically an XhrTransport is used as "XHR streaming" first and
then, if that fails, as "XHR". In some cases however it may be helpful to
suppress XHR streaming so that only XHR is attempted.
By default this property is set to false which means both
"XHR streaming" and "XHR" apply.
public boolean isXhrStreamingDisabled()
isXhrStreamingDisabled in interface XhrTransportpublic void setRequestHeaders(org.springframework.http.HttpHeaders requestHeaders)
requestHeaders - the headers to add to requestspublic org.springframework.http.HttpHeaders getRequestHeaders()
public String executeInfoRequest(URI infoUrl)
InfoReceiverexecuteInfoRequest in interface InfoReceiverinfoUrl - the URL to obtain SockJS server information fromprotected abstract org.springframework.http.ResponseEntity<String> executeInfoRequestInternal(URI infoUrl)
public void executeSendRequest(URI url, TextMessage message)
XhrTransportexecuteSendRequest in interface XhrTransporturl - the URL for sending messages.message - the message to sendprotected abstract org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message)
public org.springframework.util.concurrent.ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler)
Transportprotected abstract void connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, org.springframework.util.concurrent.SettableListenableFuture<WebSocketSession> connectFuture)