类 AbstractXhrTransport
- java.lang.Object
- org.springframework.web.socket.sockjs.client.AbstractXhrTransport
- 所有已实现的接口:
InfoReceiver
,Transport
,XhrTransport
public abstract class AbstractXhrTransport extends Object implements XhrTransport
Abstract base class for XHR transport implementations to extend.- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 AbstractXhrTransport()
方法概要
所有方法 实例方法 抽象方法 具体方法 已过时的方法 修饰符和类型 方法 说明 ListenableFuture<WebSocketSession>
connect(TransportRequest request, WebSocketHandler handler)
Connect the transport.protected abstract void
connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
String
executeInfoRequest(URI infoUrl, HttpHeaders headers)
Perform an HTTP request to the SockJS "Info" URL.protected abstract ResponseEntity<String>
executeInfoRequestInternal(URI infoUrl, HttpHeaders headers)
void
executeSendRequest(URI url, HttpHeaders headers, TextMessage message)
Execute a request to send the message to the server.protected abstract ResponseEntity<String>
executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message)
HttpHeaders
getRequestHeaders()
已过时。List<TransportType>
getTransportTypes()
Return the SockJS transport types that this transport can be used for.boolean
isXhrStreamingDisabled()
Whether XHR streaming is disabled or not.void
setRequestHeaders(HttpHeaders requestHeaders)
已过时。as of 4.2 in favor ofSockJsClient.setHttpHeaderNames(java.lang.String...)
.void
setXhrStreamingDisabled(boolean disabled)
AnXhrTransport
can support both the "xhr_streaming" and "xhr" SockJS server transports.String
toString()
构造器详细资料
AbstractXhrTransport
public AbstractXhrTransport()
方法详细资料
getTransportTypes
public List<TransportType> getTransportTypes()
从接口复制的说明:Transport
Return the SockJS transport types that this transport can be used for. In particular since from a client perspective there is no difference between XHR and XHR streaming, anXhrTransport
could do both.- 指定者:
getTransportTypes
在接口中Transport
setXhrStreamingDisabled
public void setXhrStreamingDisabled(boolean disabled)
AnXhrTransport
can support both the "xhr_streaming" and "xhr" SockJS server transports. From a client perspective there is no implementation difference.Typically an
XhrTransport
is used as "XHR streaming" first and then, if that fails, as "XHR". In some cases however it may be helpful to suppress XHR streaming so that only XHR is attempted.By default this property is set to
false
which means both "XHR streaming" and "XHR" apply.
isXhrStreamingDisabled
public boolean isXhrStreamingDisabled()
Whether XHR streaming is disabled or not.- 指定者:
isXhrStreamingDisabled
在接口中XhrTransport
setRequestHeaders
@Deprecated public void setRequestHeaders(HttpHeaders requestHeaders)
已过时。as of 4.2 in favor ofSockJsClient.setHttpHeaderNames(java.lang.String...)
.Configure headers to be added to every executed HTTP request.- 参数:
requestHeaders
- the headers to add to requests
getRequestHeaders
@Deprecated public HttpHeaders getRequestHeaders()
已过时。
connect
public ListenableFuture<WebSocketSession> connect(TransportRequest request, WebSocketHandler handler)
从接口复制的说明:Transport
Connect the transport.
connectInternal
protected abstract void connectInternal(TransportRequest request, WebSocketHandler handler, URI receiveUrl, HttpHeaders handshakeHeaders, XhrClientSockJsSession session, SettableListenableFuture<WebSocketSession> connectFuture)
executeInfoRequest
public String executeInfoRequest(URI infoUrl, HttpHeaders headers)
从接口复制的说明:InfoReceiver
Perform an HTTP request to the SockJS "Info" URL. and return the resulting JSON response content, or raise an exception.Note that as of 4.2 this method accepts a
headers
parameter.- 指定者:
executeInfoRequest
在接口中InfoReceiver
- 参数:
infoUrl
- the URL to obtain SockJS server information fromheaders
- the headers to use for the request- 返回:
- the body of the response
executeInfoRequestInternal
protected abstract ResponseEntity<String> executeInfoRequestInternal(URI infoUrl, HttpHeaders headers)
executeSendRequest
public void executeSendRequest(URI url, HttpHeaders headers, TextMessage message)
从接口复制的说明:XhrTransport
Execute a request to send the message to the server.Note that as of 4.2 this method accepts a
headers
parameter.- 指定者:
executeSendRequest
在接口中XhrTransport
- 参数:
url
- the URL for sending messages.message
- the message to send
executeSendRequestInternal
protected abstract ResponseEntity<String> executeSendRequestInternal(URI url, HttpHeaders headers, TextMessage message)