Class AbstractXhrTransport
java.lang.Object
org.springframework.web.socket.sockjs.client.AbstractXhrTransport
- All Implemented Interfaces:
- InfoReceiver,- Transport,- XhrTransport
- Direct Known Subclasses:
- JettyXhrTransport,- RestTemplateXhrTransport,- UndertowXhrTransport
Abstract base class for XHR transport implementations to extend.
- Since:
- 4.1
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionconnect(TransportRequest request, WebSocketHandler handler) Connect the transport.protected abstract voidconnectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture) executeInfoRequest(URI infoUrl, HttpHeaders headers) Perform an HTTP request to the SockJS "Info" URL.protected abstract ResponseEntity<String>executeInfoRequestInternal(URI infoUrl, HttpHeaders headers) voidexecuteSendRequest(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) Return the SockJS transport types that this transport can be used for.booleanWhether XHR streaming is disabled or not.voidsetXhrStreamingDisabled(boolean disabled) AnXhrTransportcan support both the "xhr_streaming" and "xhr" SockJS server transports.
- 
Field Details- 
PRELUDE
- 
logger
 
- 
- 
Constructor Details- 
AbstractXhrTransportpublic AbstractXhrTransport()
 
- 
- 
Method Details- 
getTransportTypesDescription copied from interface:TransportReturn the SockJS transport types that this transport can be used for. In particular since from a client perspective there is no difference between XHR and XHR streaming, anXhrTransportcould do both.- Specified by:
- getTransportTypesin interface- Transport
 
- 
setXhrStreamingDisabledpublic void setXhrStreamingDisabled(boolean disabled) AnXhrTransportcan support both the "xhr_streaming" and "xhr" SockJS server transports. From a client perspective there is no implementation difference.Typically an XhrTransportis 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 falsewhich means both "XHR streaming" and "XHR" apply.
- 
isXhrStreamingDisabledpublic boolean isXhrStreamingDisabled()Whether XHR streaming is disabled or not.- Specified by:
- isXhrStreamingDisabledin interface- XhrTransport
 
- 
connectpublic ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler) Description copied from interface:TransportConnect the transport.
- 
connectInternalprotected abstract void connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture) 
- 
executeInfoRequestDescription copied from interface:InfoReceiverPerform an HTTP request to the SockJS "Info" URL. and return the resulting JSON response content, or raise an exception.Note that as of 4.2 this method accepts a headersparameter.- Specified by:
- executeInfoRequestin interface- InfoReceiver
- Parameters:
- infoUrl- the URL to obtain SockJS server information from
- headers- the headers to use for the request
- Returns:
- the body of the response
 
- 
executeInfoRequestInternalprotected abstract ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers) 
- 
executeSendRequestDescription copied from interface:XhrTransportExecute a request to send the message to the server.Note that as of 4.2 this method accepts a headersparameter.- Specified by:
- executeSendRequestin interface- XhrTransport
- Parameters:
- url- the URL for sending messages.
- message- the message to send
 
- 
executeSendRequestInternalprotected abstract ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message) 
 
-