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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
connectInternal
(TransportRequest transportRequest, WebSocketHandler handler, URI url, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<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
boolean
void
start()
void
stop()
Methods inherited from class org.springframework.web.socket.sockjs.client.AbstractXhrTransport
connectAsync, connectInternal, executeInfoRequest, executeSendRequest, getTransportTypes, isXhrStreamingDisabled, setXhrStreamingDisabled
-
Constructor Details
-
JettyXhrTransport
public JettyXhrTransport(org.eclipse.jetty.client.HttpClient httpClient)
-
-
Method Details
-
getHttpClient
public org.eclipse.jetty.client.HttpClient getHttpClient() -
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
connectInternal
protected void connectInternal(TransportRequest transportRequest, WebSocketHandler handler, URI url, org.springframework.http.HttpHeaders handshakeHeaders, XhrClientSockJsSession session, CompletableFuture<WebSocketSession> connectFuture) - Specified by:
connectInternal
in classAbstractXhrTransport
-
executeInfoRequestInternal
protected org.springframework.http.ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, org.springframework.http.HttpHeaders headers) - Specified by:
executeInfoRequestInternal
in classAbstractXhrTransport
-
executeSendRequestInternal
public org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message) - Specified by:
executeSendRequestInternal
in classAbstractXhrTransport
-
executeRequest
-