org.springframework.web.socket.sockjs.client

## 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

    public class RestTemplateXhrTransport
    extends AbstractXhrTransport

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

Constructors
Constructor and Description
`RestTemplateXhrTransport()`
`RestTemplateXhrTransport(org.springframework.web.client.RestOperations restTemplate)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `connectInternal(TransportRequest transportRequest, WebSocketHandler handler, URI receiveUrl, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, org.springframework.util.concurrent.SettableListenableFuture<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` `getRestTemplate()` Return the configured `RestTemplate`.
`org.springframework.core.task.TaskExecutor` `getTaskExecutor()` Return the configured `TaskExecutor`.
`void` `setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)` Configure the `TaskExecutor` to use to execute XHR receive requests.

### Methods inherited from class org.springframework.web.socket.sockjs.client.AbstractXhrTransport

`connect, executeInfoRequest, executeSendRequest, getTransportTypes, isXhrStreamingDisabled, setXhrStreamingDisabled`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### RestTemplateXhrTransport

    public RestTemplateXhrTransport()

#### RestTemplateXhrTransport

    public RestTemplateXhrTransport(org.springframework.web.client.RestOperations restTemplate)

### Method Detail

#### getRestTemplate

    public org.springframework.web.client.RestOperations getRestTemplate()

Return the configured `RestTemplate`.

#### setTaskExecutor

    public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)

Configure the `TaskExecutor` 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 configured `TaskExecutor`.

#### connectInternal

    protected void connectInternal(TransportRequest transportRequest,
                                   WebSocketHandler handler,
                                   URI receiveUrl,
                                   org.springframework.http.HttpHeaders handshakeHeaders,
                                   XhrClientSockJsSession session,
                                   org.springframework.util.concurrent.SettableListenableFuture<WebSocketSession> connectFuture)

Specified by:
  `connectInternal` in class `AbstractXhrTransport`

#### executeInfoRequestInternal

    protected org.springframework.http.ResponseEntity<String> executeInfoRequestInternal(URI infoUrl,
                                                                                         org.springframework.http.HttpHeaders headers)

Specified by:
  `executeInfoRequestInternal` in class `AbstractXhrTransport`

#### executeSendRequestInternal

    public org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url,
                                                                                      org.springframework.http.HttpHeaders headers,
                                                                                      TextMessage message)

Specified by:
  `executeSendRequestInternal` in class `AbstractXhrTransport`