org.springframework.web.socket.sockjs.client

## Class JettyXhrTransport

- java.lang.Object
- - org.springframework.web.socket.sockjs.client.AbstractXhrTransport
  - - org.springframework.web.socket.sockjs.client.JettyXhrTransport

All Implemented Interfaces:
  org.springframework.context.Lifecycle, InfoReceiver, Transport, XhrTransport

    public class JettyXhrTransport
    extends AbstractXhrTransport
    implements org.springframework.context.Lifecycle

An XHR transport based on Jetty's `HttpClient`.

When used for testing purposes (e.g. load testing) the `HttpClient` properties must be set to allow a larger than usual number of connections and threads. For example:

     HttpClient httpClient = new HttpClient();
     httpClient.setMaxConnectionsPerDestination(1000);
     httpClient.setExecutor(new QueuedThreadPool(500));

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
`JettyXhrTransport(org.eclipse.jetty.client.HttpClient httpClient)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `connectInternal(TransportRequest transportRequest, WebSocketHandler handler, URI url, 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)`
`protected org.springframework.http.ResponseEntity<String>` `executeRequest(URI url, org.eclipse.jetty.http.HttpMethod method, org.springframework.http.HttpHeaders headers, String body)`
`org.springframework.http.ResponseEntity<String>` `executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message)`
`org.eclipse.jetty.client.HttpClient` `getHttpClient()`
`boolean` `isRunning()`
`void` `start()`
`void` `stop()`

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

#### JettyXhrTransport

    public JettyXhrTransport(org.eclipse.jetty.client.HttpClient httpClient)

### Method Detail

#### getHttpClient

    public org.eclipse.jetty.client.HttpClient getHttpClient()

#### start

    public void start()

Specified by:
  `start` in interface `org.springframework.context.Lifecycle`

#### stop

    public void stop()

Specified by:
  `stop` in interface `org.springframework.context.Lifecycle`

#### isRunning

    public boolean isRunning()

Specified by:
  `isRunning` in interface `org.springframework.context.Lifecycle`

#### connectInternal

    protected void connectInternal(TransportRequest transportRequest,
                                   WebSocketHandler handler,
                                   URI url,
                                   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`

#### executeRequest

    protected org.springframework.http.ResponseEntity<String> executeRequest(URI url,
                                                                             org.eclipse.jetty.http.HttpMethod method,
                                                                             org.springframework.http.HttpHeaders headers,
                                                                             @Nullable
                                                                             String body)