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
ConstructorDescriptionRestTemplateXhrTransport
(org.springframework.web.client.RestOperations restTemplate) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
connectInternal
(TransportRequest transportRequest, WebSocketHandler handler, URI receiveUrl, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<WebSocketSession> connectFuture) protected org.springframework.http.ResponseEntity<String>
executeInfoRequestInternal
(URI infoUrl, org.springframework.http.HttpHeaders headers) org.springframework.http.ResponseEntity<String>
executeSendRequestInternal
(URI url, org.springframework.http.HttpHeaders headers, TextMessage message) org.springframework.web.client.RestOperations
Return the configuredRestTemplate
.org.springframework.core.task.TaskExecutor
Return the configuredTaskExecutor
.void
setTaskExecutor
(org.springframework.core.task.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
public RestTemplateXhrTransport(org.springframework.web.client.RestOperations restTemplate)
-
-
Method Details
-
getRestTemplate
public org.springframework.web.client.RestOperations getRestTemplate()Return the configuredRestTemplate
. -
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) 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
public org.springframework.core.task.TaskExecutor getTaskExecutor()Return the configuredTaskExecutor
. -
connectInternal
protected void connectInternal(TransportRequest transportRequest, WebSocketHandler handler, URI receiveUrl, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<WebSocketSession> connectFuture) - Specified by:
connectInternal
in classAbstractXhrTransport
-
executeInfoRequestInternal
protected org.springframework.http.ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, org.springframework.http.HttpHeaders headers) - Specified by:
executeInfoRequestInternal
in classAbstractXhrTransport
-
executeSendRequestInternal
public org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message) - Specified by:
executeSendRequestInternal
in classAbstractXhrTransport
-