public class RestTemplateXhrTransport extends AbstractXhrTransport implements XhrTransport
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>> |
textExtractor
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 request,
WebSocketHandler handler,
java.net.URI receiveUrl,
HttpHeaders handshakeHeaders,
XhrClientSockJsSession session,
SettableListenableFuture<WebSocketSession> connectFuture) |
ResponseEntity<java.lang.String> |
executeInfoRequestInternal(java.net.URI infoUrl) |
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 . |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Configure the
TaskExecutor to use to execute XHR receive requests. |
connect, executeInfoRequest, executeSendRequest, getRequestHeaders, getTransportTypes, isXhrStreamingDisabled, setRequestHeaders, setXhrStreamingDisabled, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
executeSendRequest, isXhrStreamingDisabled
connect, getTransportTypes
executeInfoRequest
private final RestOperations restTemplate
private TaskExecutor taskExecutor
private static final ResponseExtractor<ResponseEntity<java.lang.String>> textExtractor
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
.public ResponseEntity<java.lang.String> executeInfoRequestInternal(java.net.URI infoUrl)
executeInfoRequestInternal
in class AbstractXhrTransport
public ResponseEntity<java.lang.String> executeSendRequestInternal(java.net.URI url, HttpHeaders headers, TextMessage message)
executeSendRequestInternal
in class AbstractXhrTransport
protected void connectInternal(TransportRequest request, WebSocketHandler handler, java.net.URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
connectInternal
in class AbstractXhrTransport