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()
Transport
XhrTransport
could do both.getTransportTypes
in interface Transport
public 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 XhrTransport
public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler)
Transport
protected abstract void connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
public String executeInfoRequest(URI infoUrl, @Nullable HttpHeaders headers)
InfoReceiver
Note that as of 4.2 this method accepts a headers
parameter.
executeInfoRequest
in interface InfoReceiver
infoUrl
- 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)
XhrTransport
Note that as of 4.2 this method accepts a headers
parameter.
executeSendRequest
in interface XhrTransport
url
- the URL for sending messages.message
- the message to sendprotected abstract ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message)