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 |
|---|---|
ListenableFuture<WebSocketSession> |
connect(TransportRequest request,
WebSocketHandler handler)
Connect the transport.
|
protected abstract void |
connectInternal(TransportRequest request,
WebSocketHandler handler,
URI receiveUrl,
HttpHeaders handshakeHeaders,
XhrClientSockJsSession session,
SettableListenableFuture<WebSocketSession> connectFuture) |
String |
executeInfoRequest(URI infoUrl,
HttpHeaders headers)
Perform an HTTP request to the SockJS "Info" URL.
|
protected abstract ResponseEntity<String> |
executeInfoRequestInternal(URI infoUrl,
HttpHeaders headers) |
void |
executeSendRequest(URI url,
HttpHeaders headers,
TextMessage message)
Execute a request to send the message to the server.
|
protected abstract ResponseEntity<String> |
executeSendRequestInternal(URI url,
HttpHeaders headers,
TextMessage message) |
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 |
setXhrStreamingDisabled(boolean disabled)
An
XhrTransport can support both the "xhr_streaming" and "xhr"
SockJS server transports. |
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 ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler)
Transportprotected abstract void connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
public String executeInfoRequest(URI infoUrl, @Nullable HttpHeaders headers)
InfoReceiverNote that as of 4.2 this method accepts a headers parameter.
executeInfoRequest in interface InfoReceiverinfoUrl - the URL to obtain SockJS server information fromheaders - the headers to use for the requestprotected abstract ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers)
public void executeSendRequest(URI url, HttpHeaders headers, TextMessage message)
XhrTransportNote that as of 4.2 this method accepts a headers parameter.
executeSendRequest in interface XhrTransporturl - the URL for sending messages.message - the message to sendprotected abstract ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message)