public class UndertowXhrTransport extends AbstractXhrTransport
io.undertow.client.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);
org.xnio.Options
Modifier and Type | Class and Description |
---|---|
private class |
UndertowXhrTransport.SockJsResponseListener |
Modifier and Type | Field and Description |
---|---|
private ByteBufferPool |
bufferPool |
private UndertowClient |
httpClient |
private OptionMap |
optionMap |
private static <any> |
RESPONSE_BODY |
private XnioWorker |
worker |
logger, PRELUDE
Constructor and Description |
---|
UndertowXhrTransport() |
UndertowXhrTransport(OptionMap optionMap) |
Modifier and Type | Method and Description |
---|---|
private static void |
addHttpHeaders(ClientRequest request,
HttpHeaders headers) |
protected void |
connectInternal(TransportRequest request,
WebSocketHandler handler,
java.net.URI receiveUrl,
HttpHeaders handshakeHeaders,
XhrClientSockJsSession session,
SettableListenableFuture<WebSocketSession> connectFuture) |
private <any> |
createReceiveCallback(TransportRequest transportRequest,
java.net.URI url,
HttpHeaders headers,
XhrClientSockJsSession sockJsSession,
SettableListenableFuture<WebSocketSession> connectFuture) |
private <any> |
createRequestCallback(java.lang.String body,
java.util.List<ClientResponse> responses,
java.util.concurrent.CountDownLatch latch) |
protected ResponseEntity<java.lang.String> |
executeInfoRequestInternal(java.net.URI infoUrl,
HttpHeaders headers) |
private void |
executeReceiveRequest(TransportRequest transportRequest,
java.net.URI url,
HttpHeaders headers,
XhrClientSockJsSession session,
SettableListenableFuture<WebSocketSession> connectFuture) |
protected ResponseEntity<java.lang.String> |
executeRequest(java.net.URI url,
HttpString method,
HttpHeaders headers,
java.lang.String body) |
protected ResponseEntity<java.lang.String> |
executeSendRequestInternal(java.net.URI url,
HttpHeaders headers,
TextMessage message) |
UndertowClient |
getHttpClient()
Return Undertow's native HTTP client
|
XnioWorker |
getWorker()
Return the
org.xnio.XnioWorker backing the I/O operations
for Undertow's HTTP client. |
private static HttpHeaders |
toHttpHeaders(HeaderMap headerMap) |
connect, executeInfoRequest, executeSendRequest, getTransportTypes, isXhrStreamingDisabled, setXhrStreamingDisabled, toString
private static final <any> RESPONSE_BODY
private final OptionMap optionMap
private final UndertowClient httpClient
private final XnioWorker worker
private final ByteBufferPool bufferPool
public UndertowXhrTransport() throws java.io.IOException
java.io.IOException
public UndertowXhrTransport(OptionMap optionMap) throws java.io.IOException
java.io.IOException
public UndertowClient getHttpClient()
public XnioWorker getWorker()
org.xnio.XnioWorker
backing the I/O operations
for Undertow's HTTP client.org.xnio.Xnio
protected void connectInternal(TransportRequest request, WebSocketHandler handler, java.net.URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
connectInternal
in class AbstractXhrTransport
private void executeReceiveRequest(TransportRequest transportRequest, java.net.URI url, HttpHeaders headers, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
private static void addHttpHeaders(ClientRequest request, HttpHeaders headers)
private <any> createReceiveCallback(TransportRequest transportRequest, java.net.URI url, HttpHeaders headers, XhrClientSockJsSession sockJsSession, SettableListenableFuture<WebSocketSession> connectFuture)
private static HttpHeaders toHttpHeaders(HeaderMap headerMap)
protected ResponseEntity<java.lang.String> executeInfoRequestInternal(java.net.URI infoUrl, HttpHeaders headers)
executeInfoRequestInternal
in class AbstractXhrTransport
protected ResponseEntity<java.lang.String> executeSendRequestInternal(java.net.URI url, HttpHeaders headers, TextMessage message)
executeSendRequestInternal
in class AbstractXhrTransport
protected ResponseEntity<java.lang.String> executeRequest(java.net.URI url, HttpString method, HttpHeaders headers, java.lang.String body)
private <any> createRequestCallback(java.lang.String body, java.util.List<ClientResponse> responses, java.util.concurrent.CountDownLatch latch)