|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -383,7 +383,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
@@ -383,7 +383,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|
|
|
|
* An empty {@code HttpHeaders} instance (immutable). |
|
|
|
|
* @since 5.0 |
|
|
|
|
*/ |
|
|
|
|
public static final HttpHeaders EMPTY = new ReadOnlyHttpHeaders(new HttpHeaders(new LinkedMultiValueMap<>(0))); |
|
|
|
|
public static final HttpHeaders EMPTY = new ReadOnlyHttpHeaders(new LinkedMultiValueMap<>()); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match". |
|
|
|
|
@ -1085,6 +1085,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
@@ -1085,6 +1085,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return the value of the {@code If-Match} header. |
|
|
|
|
* @throws IllegalArgumentException if parsing fails |
|
|
|
|
* @since 4.3 |
|
|
|
|
*/ |
|
|
|
|
public List<String> getIfMatch() { |
|
|
|
|
@ -1144,6 +1145,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
@@ -1144,6 +1145,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return the value of the {@code If-None-Match} header. |
|
|
|
|
* @throws IllegalArgumentException if parsing fails |
|
|
|
|
*/ |
|
|
|
|
public List<String> getIfNoneMatch() { |
|
|
|
|
return getETagValuesAsList(IF_NONE_MATCH); |
|
|
|
|
@ -1471,6 +1473,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
@@ -1471,6 +1473,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|
|
|
|
* Retrieve a combined result from the field values of the ETag header. |
|
|
|
|
* @param headerName the header name |
|
|
|
|
* @return the combined result |
|
|
|
|
* @throws IllegalArgumentException if parsing fails |
|
|
|
|
* @since 4.3 |
|
|
|
|
*/ |
|
|
|
|
protected List<String> getETagValuesAsList(String headerName) { |
|
|
|
|
@ -1699,17 +1702,21 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
@@ -1699,17 +1702,21 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Apply a read-only {@code HttpHeaders} wrapper around the given headers. |
|
|
|
|
* Apply a read-only {@code HttpHeaders} wrapper around the given headers, |
|
|
|
|
* if necessary. |
|
|
|
|
* @param headers the headers to expose |
|
|
|
|
* @return a read-only variant of the headers, or the original headers as-is |
|
|
|
|
*/ |
|
|
|
|
public static HttpHeaders readOnlyHttpHeaders(MultiValueMap<String, String> headers) { |
|
|
|
|
public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers) { |
|
|
|
|
Assert.notNull(headers, "HttpHeaders must not be null"); |
|
|
|
|
return (headers instanceof ReadOnlyHttpHeaders ? |
|
|
|
|
(HttpHeaders) headers : new ReadOnlyHttpHeaders(headers)); |
|
|
|
|
return (headers instanceof ReadOnlyHttpHeaders ? headers : new ReadOnlyHttpHeaders(headers.headers)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Remove any read-only wrapper that may have been previously applied around |
|
|
|
|
* the given headers via {@link #readOnlyHttpHeaders(MultiValueMap)}. |
|
|
|
|
* the given headers via {@link #readOnlyHttpHeaders(HttpHeaders)}. |
|
|
|
|
* @param headers the headers to expose |
|
|
|
|
* @return a writable variant of the headers, or the original headers as-is |
|
|
|
|
* @since 5.1.1 |
|
|
|
|
*/ |
|
|
|
|
public static HttpHeaders writableHttpHeaders(HttpHeaders headers) { |
|
|
|
|
|