|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -26,6 +26,7 @@ import java.util.Set; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* An {@link org.springframework.http.HttpHeaders} variant that adds support for |
|
|
|
* An {@link org.springframework.http.HttpHeaders} variant that adds support for |
|
|
|
@ -56,7 +57,7 @@ public class WebSocketHttpHeaders extends HttpHeaders { |
|
|
|
* Create a new instance. |
|
|
|
* Create a new instance. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public WebSocketHttpHeaders() { |
|
|
|
public WebSocketHttpHeaders() { |
|
|
|
this(new HttpHeaders(), false); |
|
|
|
this(new HttpHeaders()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -65,21 +66,16 @@ public class WebSocketHttpHeaders extends HttpHeaders { |
|
|
|
* @param headers the HTTP headers to wrap |
|
|
|
* @param headers the HTTP headers to wrap |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public WebSocketHttpHeaders(HttpHeaders headers) { |
|
|
|
public WebSocketHttpHeaders(HttpHeaders headers) { |
|
|
|
this(headers, false); |
|
|
|
this.headers = headers; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Private constructor that can create read-only {@code WebSocketHttpHeader} instances. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private WebSocketHttpHeaders(HttpHeaders headers, boolean readOnly) { |
|
|
|
|
|
|
|
this.headers = readOnly ? HttpHeaders.readOnlyHttpHeaders(headers) : headers; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns {@code WebSocketHttpHeaders} object that can only be read, not written to. |
|
|
|
* Returns {@code WebSocketHttpHeaders} object that can only be read, not written to. |
|
|
|
|
|
|
|
* @deprecated as of 5.2.7 in favor of {@link HttpHeaders#readOnlyHttpHeaders(MultiValueMap)} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public static WebSocketHttpHeaders readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers) { |
|
|
|
public static WebSocketHttpHeaders readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers) { |
|
|
|
return new WebSocketHttpHeaders(headers, true); |
|
|
|
return new WebSocketHttpHeaders(HttpHeaders.readOnlyHttpHeaders(headers)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|