|
|
|
@ -104,7 +104,7 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UndertowXhrTransport(OptionMap optionMap) throws IOException { |
|
|
|
public UndertowXhrTransport(OptionMap optionMap) throws IOException { |
|
|
|
Assert.notNull(optionMap, "'optionMap' is required"); |
|
|
|
Assert.notNull(optionMap, "OptionMap is required"); |
|
|
|
this.httpClient = UndertowClient.getInstance(); |
|
|
|
this.httpClient = UndertowClient.getInstance(); |
|
|
|
this.optionMap = optionMap; |
|
|
|
this.optionMap = optionMap; |
|
|
|
this.worker = Xnio.getInstance().createWorker(optionMap); |
|
|
|
this.worker = Xnio.getInstance().createWorker(optionMap); |
|
|
|
@ -142,12 +142,11 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
final SettableListenableFuture<WebSocketSession> connectFuture) { |
|
|
|
final SettableListenableFuture<WebSocketSession> connectFuture) { |
|
|
|
|
|
|
|
|
|
|
|
if (logger.isTraceEnabled()) { |
|
|
|
if (logger.isTraceEnabled()) { |
|
|
|
logger.trace("Starting XHR receive request, url=" + url); |
|
|
|
logger.trace("Starting XHR receive request for " + url); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.httpClient.connect( |
|
|
|
this.httpClient.connect( |
|
|
|
new ClientCallback<ClientConnection>() { |
|
|
|
new ClientCallback<ClientConnection>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void completed(ClientConnection connection) { |
|
|
|
public void completed(ClientConnection connection) { |
|
|
|
ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(url.getPath()); |
|
|
|
ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(url.getPath()); |
|
|
|
@ -158,7 +157,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
connection.sendRequest(request, createReceiveCallback(transportRequest, |
|
|
|
connection.sendRequest(request, createReceiveCallback(transportRequest, |
|
|
|
url, httpHeaders, session, connectFuture)); |
|
|
|
url, httpHeaders, session, connectFuture)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void failed(IOException ex) { |
|
|
|
public void failed(IOException ex) { |
|
|
|
throw new SockJsTransportFailureException("Failed to execute request to " + url, ex); |
|
|
|
throw new SockJsTransportFailureException("Failed to execute request to " + url, ex); |
|
|
|
@ -181,11 +179,9 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
final SettableListenableFuture<WebSocketSession> connectFuture) { |
|
|
|
final SettableListenableFuture<WebSocketSession> connectFuture) { |
|
|
|
|
|
|
|
|
|
|
|
return new ClientCallback<ClientExchange>() { |
|
|
|
return new ClientCallback<ClientExchange>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void completed(final ClientExchange exchange) { |
|
|
|
public void completed(final ClientExchange exchange) { |
|
|
|
exchange.setResponseListener(new ClientCallback<ClientExchange>() { |
|
|
|
exchange.setResponseListener(new ClientCallback<ClientExchange>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void completed(ClientExchange result) { |
|
|
|
public void completed(ClientExchange result) { |
|
|
|
ClientResponse response = result.getResponse(); |
|
|
|
ClientResponse response = result.getResponse(); |
|
|
|
@ -216,7 +212,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
onFailure(exc); |
|
|
|
onFailure(exc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void failed(IOException exc) { |
|
|
|
public void failed(IOException exc) { |
|
|
|
IoUtils.safeClose(exchange.getConnection()); |
|
|
|
IoUtils.safeClose(exchange.getConnection()); |
|
|
|
@ -307,7 +302,6 @@ public class UndertowXhrTransport extends AbstractXhrTransport implements XhrTra |
|
|
|
final List<ClientResponse> responses, final CountDownLatch latch) { |
|
|
|
final List<ClientResponse> responses, final CountDownLatch latch) { |
|
|
|
|
|
|
|
|
|
|
|
return new ClientCallback<ClientExchange>() { |
|
|
|
return new ClientCallback<ClientExchange>() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void completed(ClientExchange result) { |
|
|
|
public void completed(ClientExchange result) { |
|
|
|
result.setResponseListener(new ClientCallback<ClientExchange>() { |
|
|
|
result.setResponseListener(new ClientCallback<ClientExchange>() { |
|
|
|
|