org.springframework.web.socket.sockjs.client

## Class UndertowXhrTransport

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

All Implemented Interfaces:
  InfoReceiver, Transport, XhrTransport

    public class UndertowXhrTransport
    extends AbstractXhrTransport

An XHR transport based on Undertow's `UndertowClient`. Requires Undertow 1.3 or 1.4, including XNIO, as of Spring Framework 5.0.

When used for testing purposes (e.g. load testing) or for specific use cases (like HTTPS configuration), a custom OptionMap should be provided:

     OptionMap optionMap = OptionMap.builder()
       .set(Options.WORKER_IO_THREADS, 8)
       .set(Options.TCP_NODELAY, true)
       .set(Options.KEEP_ALIVE, true)
       .set(Options.WORKER_NAME, "SockJSClient")
       .getMap();

     UndertowXhrTransport transport = new UndertowXhrTransport(optionMap);

Since:
  4.1.2
Author:
  Brian Clozel, Rossen Stoyanchev
See Also:
  `Options`

### Field Summary

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

`logger, PRELUDE`

### Constructor Summary

Constructors
Constructor and Description
`UndertowXhrTransport()`
`UndertowXhrTransport(OptionMap optionMap)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `connectInternal(TransportRequest request, 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)`
`protected org.springframework.http.ResponseEntity<String>` `executeRequest(URI url, io.undertow.util.HttpString method, org.springframework.http.HttpHeaders headers, String body)`
`protected org.springframework.http.ResponseEntity<String>` `executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message)`
`io.undertow.client.UndertowClient` `getHttpClient()` Return Undertow's native HTTP client.
`XnioWorker` `getWorker()` Return the `XnioWorker` backing the I/O operations for Undertow's HTTP client.

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

#### UndertowXhrTransport

    public UndertowXhrTransport()
                         throws IOException

Throws:
  `IOException`

#### UndertowXhrTransport

    public UndertowXhrTransport(OptionMap optionMap)
                         throws IOException

Throws:
  `IOException`

### Method Detail

#### getHttpClient

    public io.undertow.client.UndertowClient getHttpClient()

Return Undertow's native HTTP client.

#### getWorker

    public XnioWorker getWorker()

Return the `XnioWorker` backing the I/O operations for Undertow's HTTP client.

See Also:
  `Xnio`

#### connectInternal

    protected void connectInternal(TransportRequest request,
                                   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

    protected 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,
                                                                             io.undertow.util.HttpString method,
                                                                             org.springframework.http.HttpHeaders headers,
                                                                             @Nullable
                                                                             String body)