Class RestTemplateXhrTransport
java.lang.Object
org.springframework.web.socket.sockjs.client.AbstractXhrTransport
org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport
- All Implemented Interfaces:
InfoReceiver
,Transport
,XhrTransport
An
XhrTransport
implementation that uses a
RestTemplate
.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.socket.sockjs.client.AbstractXhrTransport
logger, PRELUDE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
connectInternal
(TransportRequest transportRequest, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<WebSocketSession> connectFuture) protected ResponseEntity<String>
executeInfoRequestInternal
(URI infoUrl, HttpHeaders headers) executeSendRequestInternal
(URI url, HttpHeaders headers, TextMessage message) Return the configuredRestTemplate
.Return the configuredTaskExecutor
.void
setTaskExecutor
(TaskExecutor taskExecutor) Configure theTaskExecutor
to use to execute XHR receive requests.Methods inherited from class org.springframework.web.socket.sockjs.client.AbstractXhrTransport
connectAsync, connectInternal, executeInfoRequest, executeSendRequest, getTransportTypes, isXhrStreamingDisabled, setXhrStreamingDisabled
-
Constructor Details
-
RestTemplateXhrTransport
public RestTemplateXhrTransport() -
RestTemplateXhrTransport
-
-
Method Details
-
getRestTemplate
Return the configuredRestTemplate
. -
setTaskExecutor
Configure theTaskExecutor
to use to execute XHR receive requests.By default
SimpleAsyncTaskExecutor
is configured which creates a new thread every time the transports connects. -
getTaskExecutor
Return the configuredTaskExecutor
. -
connectInternal
protected void connectInternal(TransportRequest transportRequest, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<WebSocketSession> connectFuture) - Specified by:
connectInternal
in classAbstractXhrTransport
-
executeInfoRequestInternal
- Specified by:
executeInfoRequestInternal
in classAbstractXhrTransport
-
executeSendRequestInternal
public ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message) - Specified by:
executeSendRequestInternal
in classAbstractXhrTransport
-