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 (for example, 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 AbstractXhrTransport
logger, PRELUDE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconnectInternal(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, @Nullable String body) org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message) org.eclipse.jetty.client.HttpClientbooleanvoidstart()voidstop()Methods inherited from class AbstractXhrTransport
connectAsync, 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:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin 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:
connectInternalin classAbstractXhrTransport
-
executeInfoRequestInternal
protected org.springframework.http.ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, org.springframework.http.HttpHeaders headers) - Specified by:
executeInfoRequestInternalin classAbstractXhrTransport
-
executeSendRequestInternal
public org.springframework.http.ResponseEntity<String> executeSendRequestInternal(URI url, org.springframework.http.HttpHeaders headers, TextMessage message) - Specified by:
executeSendRequestInternalin classAbstractXhrTransport
-
executeRequest
-