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
  • 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 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, CompletableFuture<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