public class RestTemplateXhrTransport extends AbstractXhrTransport
XhrTransport
implementation that uses a
RestTemplate
.Modifier and Type | Class and Description |
---|---|
private class |
RestTemplateXhrTransport.XhrReceiveExtractor
Splits the body of an HTTP response into SockJS frames and delegates those
to an
XhrClientSockJsSession . |
private static class |
RestTemplateXhrTransport.XhrRequestCallback
A RequestCallback to add the headers and (optionally) String content.
|
Modifier and Type | Field and Description |
---|---|
private RestOperations |
restTemplate |
private TaskExecutor |
taskExecutor |
private static ResponseExtractor<ResponseEntity<java.lang.String>> |
textResponseExtractor
A simple ResponseExtractor that reads the body into a String.
|
logger, PRELUDE
Constructor and Description |
---|
RestTemplateXhrTransport() |
RestTemplateXhrTransport(RestOperations restTemplate) |
Modifier and Type | Method and Description |
---|---|
protected void |
connectInternal(TransportRequest transportRequest,
WebSocketHandler handler,
java.net.URI receiveUrl,
HttpHeaders handshakeHeaders,
XhrClientSockJsSession session,
SettableListenableFuture<WebSocketSession> connectFuture) |
protected ResponseEntity<java.lang.String> |
executeInfoRequestInternal(java.net.URI infoUrl,
HttpHeaders headers) |
ResponseEntity<java.lang.String> |
executeSendRequestInternal(java.net.URI url,
HttpHeaders headers,
TextMessage message) |
RestOperations |
getRestTemplate()
Return the configured
RestTemplate . |
TaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor . |
private static <T> T |
nonNull(T result) |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Configure the
TaskExecutor to use to execute XHR receive requests. |
connect, executeInfoRequest, executeSendRequest, getTransportTypes, isXhrStreamingDisabled, setXhrStreamingDisabled, toString
private final RestOperations restTemplate
private TaskExecutor taskExecutor
private static final ResponseExtractor<ResponseEntity<java.lang.String>> textResponseExtractor
public RestTemplateXhrTransport()
public RestTemplateXhrTransport(RestOperations restTemplate)
public RestOperations getRestTemplate()
RestTemplate
.public void setTaskExecutor(TaskExecutor taskExecutor)
TaskExecutor
to use to execute XHR receive requests.
By default SimpleAsyncTaskExecutor
is configured which creates a new thread every
time the transports connects.
public TaskExecutor getTaskExecutor()
TaskExecutor
.protected void connectInternal(TransportRequest transportRequest, WebSocketHandler handler, java.net.URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
connectInternal
in class AbstractXhrTransport
protected ResponseEntity<java.lang.String> executeInfoRequestInternal(java.net.URI infoUrl, HttpHeaders headers)
executeInfoRequestInternal
in class AbstractXhrTransport
public ResponseEntity<java.lang.String> executeSendRequestInternal(java.net.URI url, HttpHeaders headers, TextMessage message)
executeSendRequestInternal
in class AbstractXhrTransport
private static <T> T nonNull(@Nullable T result)