本文整理了Java中org.springframework.web.socket.WebSocketHttpHeaders.set()
方法的一些代码示例,展示了WebSocketHttpHeaders.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketHttpHeaders.set()
方法的具体详情如下:
包路径:org.springframework.web.socket.WebSocketHttpHeaders
类名称:WebSocketHttpHeaders
方法名:set
[英]Set the given, single header value under the given name.
[中]
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocol the value of the header
*/
public void setSecWebSocketProtocol(String secWebSocketProtocol) {
set(SEC_WEBSOCKET_PROTOCOL, secWebSocketProtocol);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value of the {@code Sec-WebSocket-Accept} header.
* @param secWebSocketAccept the value of the header
*/
public void setSecWebSocketAccept(@Nullable String secWebSocketAccept) {
set(SEC_WEBSOCKET_ACCEPT, secWebSocketAccept);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value of the {@code Sec-WebSocket-Key} header.
* @param secWebSocketKey the value of the header
*/
public void setSecWebSocketKey(@Nullable String secWebSocketKey) {
set(SEC_WEBSOCKET_KEY, secWebSocketKey);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value of the {@code Sec-WebSocket-Version} header.
* @param secWebSocketVersion the value of the header
*/
public void setSecWebSocketVersion(@Nullable String secWebSocketVersion) {
set(SEC_WEBSOCKET_VERSION, secWebSocketVersion);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocols the value of the header
*/
public void setSecWebSocketProtocol(List<String> secWebSocketProtocols) {
set(SEC_WEBSOCKET_PROTOCOL, toCommaDelimitedString(secWebSocketProtocols));
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Sets the (new) value(s) of the {@code Sec-WebSocket-Extensions} header.
* @param extensions the values for the header
*/
public void setSecWebSocketExtensions(List<WebSocketExtension> extensions) {
List<String> result = new ArrayList<>(extensions.size());
for (WebSocketExtension extension : extensions) {
result.add(extension.toString());
}
set(SEC_WEBSOCKET_EXTENSIONS, toCommaDelimitedString(result));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void connectAndUseSubsetOfHandshakeHeadersForHttpRequests() throws Exception {
ArgumentCaptor<HttpHeaders> headersCaptor = setupInfoRequest(false);
this.xhrTransport.setStreamingDisabled(true);
WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
headers.set("foo", "bar");
headers.set("auth", "123");
this.sockJsClient.setHttpHeaderNames("auth");
this.sockJsClient.doHandshake(handler, headers, new URI(URL)).addCallback(this.connectCallback);
assertEquals(1, headersCaptor.getValue().size());
assertEquals("123", headersCaptor.getValue().getFirst("auth"));
assertEquals(1, this.xhrTransport.getRequest().getHttpRequestHeaders().size());
assertEquals("123", this.xhrTransport.getRequest().getHttpRequestHeaders().getFirst("auth"));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void connectWithHandshakeHeaders() throws Exception {
ArgumentCaptor<HttpHeaders> headersCaptor = setupInfoRequest(false);
this.xhrTransport.setStreamingDisabled(true);
WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
headers.set("foo", "bar");
headers.set("auth", "123");
this.sockJsClient.doHandshake(handler, headers, new URI(URL)).addCallback(this.connectCallback);
HttpHeaders httpHeaders = headersCaptor.getValue();
assertEquals(2, httpHeaders.size());
assertEquals("bar", httpHeaders.getFirst("foo"));
assertEquals("123", httpHeaders.getFirst("auth"));
httpHeaders = this.xhrTransport.getRequest().getHttpRequestHeaders();
assertEquals(2, httpHeaders.size());
assertEquals("bar", httpHeaders.getFirst("foo"));
assertEquals("123", httpHeaders.getFirst("auth"));
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocol the value of the header
*/
public void setSecWebSocketProtocol(String secWebSocketProtocol) {
set(SEC_WEBSOCKET_PROTOCOL, secWebSocketProtocol);
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocol the value of the header
*/
public void setSecWebSocketProtocol(String secWebSocketProtocol) {
set(SEC_WEBSOCKET_PROTOCOL, secWebSocketProtocol);
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value of the {@code Sec-WebSocket-Version} header.
* @param secWebSocketVersion the value of the header
*/
public void setSecWebSocketVersion(@Nullable String secWebSocketVersion) {
set(SEC_WEBSOCKET_VERSION, secWebSocketVersion);
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value of the {@code Sec-WebSocket-Key} header.
* @param secWebSocketKey the value of the header
*/
public void setSecWebSocketKey(@Nullable String secWebSocketKey) {
set(SEC_WEBSOCKET_KEY, secWebSocketKey);
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value of the {@code Sec-WebSocket-Accept} header.
* @param secWebSocketAccept the value of the header
*/
public void setSecWebSocketAccept(@Nullable String secWebSocketAccept) {
set(SEC_WEBSOCKET_ACCEPT, secWebSocketAccept);
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value of the {@code Sec-WebSocket-Key} header.
* @param secWebSocketKey the value of the header
*/
public void setSecWebSocketKey(@Nullable String secWebSocketKey) {
set(SEC_WEBSOCKET_KEY, secWebSocketKey);
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value of the {@code Sec-WebSocket-Version} header.
* @param secWebSocketVersion the value of the header
*/
public void setSecWebSocketVersion(@Nullable String secWebSocketVersion) {
set(SEC_WEBSOCKET_VERSION, secWebSocketVersion);
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value of the {@code Sec-WebSocket-Accept} header.
* @param secWebSocketAccept the value of the header
*/
public void setSecWebSocketAccept(@Nullable String secWebSocketAccept) {
set(SEC_WEBSOCKET_ACCEPT, secWebSocketAccept);
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocols the value of the header
*/
public void setSecWebSocketProtocol(List<String> secWebSocketProtocols) {
set(SEC_WEBSOCKET_PROTOCOL, toCommaDelimitedString(secWebSocketProtocols));
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value of the {@code Sec-WebSocket-Protocol} header.
* @param secWebSocketProtocols the value of the header
*/
public void setSecWebSocketProtocol(List<String> secWebSocketProtocols) {
set(SEC_WEBSOCKET_PROTOCOL, toCommaDelimitedString(secWebSocketProtocols));
}
代码示例来源:origin: org.springframework/spring-websocket
/**
* Sets the (new) value(s) of the {@code Sec-WebSocket-Extensions} header.
* @param extensions the values for the header
*/
public void setSecWebSocketExtensions(List<WebSocketExtension> extensions) {
List<String> result = new ArrayList<>(extensions.size());
for (WebSocketExtension extension : extensions) {
result.add(extension.toString());
}
set(SEC_WEBSOCKET_EXTENSIONS, toCommaDelimitedString(result));
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Sets the (new) value(s) of the {@code Sec-WebSocket-Extensions} header.
* @param extensions the values for the header
*/
public void setSecWebSocketExtensions(List<WebSocketExtension> extensions) {
List<String> result = new ArrayList<>(extensions.size());
for (WebSocketExtension extension : extensions) {
result.add(extension.toString());
}
set(SEC_WEBSOCKET_EXTENSIONS, toCommaDelimitedString(result));
}
内容来源于网络,如有侵权,请联系作者删除!