Introducing `valueSeparatorRegex`, defaults to `\s,\s` (single comma, optional whitespace)
diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientRequestContext.java b/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientRequestContext.java index 9873f40..70e7af5 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientRequestContext.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientRequestContext.java
@@ -201,12 +201,13 @@ * class or using its {@code toString} method if a header delegate is not available. * * <p> - * For example: {@code containsHeaderString("cache-control", "no-store"::equalsIgnoreCase)} will return {@code true} if + * For example: {@code containsHeaderString("cache-control", null, "no-store"::equalsIgnoreCase)} will return {@code true} if * a {@code Cache-Control} header exists that has the value {@code no-store}, the value {@code No-Store} or the value * {@code Max-Age, NO-STORE, no-transform}, but {@code false} when it has the value {@code no-store;no-transform} * (missing comma), or the value {@code no - store} (whitespace within value). * * @param name the message header. + * @param valueSeparatorRegex Separates the header value into single values. Defaults to {@code \s*,\s*} when {@code null}. * @param valuePredicate value must fulfil this predicate. * @return {@code true} if and only if a header with the given name exists, having either a whitespace-trimmed value * matching the predicate, or having at least one whitespace-trimmed single value in a comma-separated list of single values. @@ -214,7 +215,7 @@ * @see #getHeaderString(String) * @since 4.0 */ - public boolean containsHeaderString(String name, Predicate<String> valuePredicate); + public boolean containsHeaderString(String name, String valueSeparatorRegex, Predicate<String> valuePredicate); /** * Get message date.
diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientResponseContext.java b/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientResponseContext.java index 807ede7..8abcc0b 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientResponseContext.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/client/ClientResponseContext.java
@@ -93,12 +93,13 @@ * Checks whether a header with a specific name and value (or item of the comma-separated value list) exists. * * <p> - * For example: {@code containsHeaderString("cache-control", "no-store"::equalsIgnoreCase)} will return {@code true} if + * For example: {@code containsHeaderString("cache-control", null, "no-store"::equalsIgnoreCase)} will return {@code true} if * a {@code Cache-Control} header exists that has the value {@code no-store}, the value {@code No-Store} or the value * {@code Max-Age, NO-STORE, no-transform}, but {@code false} when it has the value {@code no-store;no-transform} * (missing comma), or the value {@code no - store} (whitespace within value). * * @param name the message header. + * @param valueSeparatorRegex Separates the header value into single values. Defaults to {@code \s*,\s*} when {@code null}. * @param valuePredicate value must fulfil this predicate. * @return {@code true} if and only if a header with the given name exists, having either a whitespace-trimmed value * matching the predicate, or having at least one whitespace-trimmed single value in a comma-separated list of single values. @@ -106,7 +107,7 @@ * @see #getHeaderString(String) * @since 4.0 */ - public boolean containsHeaderString(String name, Predicate<String> valuePredicate); + public boolean containsHeaderString(String name, String valueSeparatorRegex, Predicate<String> valuePredicate); /** * Get the allowed HTTP methods from the Allow HTTP header.
diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerRequestContext.java b/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerRequestContext.java index 9a50430..b755913 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerRequestContext.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerRequestContext.java
@@ -233,12 +233,13 @@ * Checks whether a header with a specific name and value (or item of the comma-separated value list) exists. * * <p> - * For example: {@code containsHeaderString("cache-control", "no-store"::equalsIgnoreCase)} will return {@code true} if + * For example: {@code containsHeaderString("cache-control", null, "no-store"::equalsIgnoreCase)} will return {@code true} if * a {@code Cache-Control} header exists that has the value {@code no-store}, the value {@code No-Store} or the value * {@code Max-Age, NO-STORE, no-transform}, but {@code false} when it has the value {@code no-store;no-transform} * (missing comma), or the value {@code no - store} (whitespace within value). * * @param name the message header. + * @param valueSeparatorRegex Separates the header value into single values. Defaults to {@code \s*,\s*} when {@code null}. * @param valuePredicate value must fulfil this predicate. * @return {@code true} if and only if a header with the given name exists, having either a whitespace-trimmed value * matching the predicate, or having at least one whitespace-trimmed single value in a comma-separated list of single values. @@ -246,7 +247,7 @@ * @see #getHeaderString(String) * @since 4.0 */ - public boolean containsHeaderString(String name, Predicate<String> valuePredicate); + public boolean containsHeaderString(String name, String valueSeparatorRegex, Predicate<String> valuePredicate); /** * Get message date.
diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerResponseContext.java b/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerResponseContext.java index 70fe218..936f5cc 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerResponseContext.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/container/ContainerResponseContext.java
@@ -123,12 +123,13 @@ * class or using its {@code toString} method if a header delegate is not available. * * <p> - * For example: {@code containsHeaderString("cache-control", "no-store"::equalsIgnoreCase)} will return {@code true} if + * For example: {@code containsHeaderString("cache-control", null, "no-store"::equalsIgnoreCase)} will return {@code true} if * a {@code Cache-Control} header exists that has the value {@code no-store}, the value {@code No-Store} or the value * {@code Max-Age, NO-STORE, no-transform}, but {@code false} when it has the value {@code no-store;no-transform} * (missing comma), or the value {@code no - store} (whitespace within value). * * @param name the message header. + * @param valueSeparatorRegex Separates the header value into single values. Defaults to {@code \s*,\s*} when {@code null}. * @param valuePredicate value must fulfil this predicate. * @return {@code true} if and only if a header with the given name exists, having either a whitespace-trimmed value * matching the predicate, or having at least one whitespace-trimmed single value in a comma-separated list of single values. @@ -136,7 +137,7 @@ * @see #getHeaderString(String) * @since 4.0 */ - public boolean containsHeaderString(String name, Predicate<String> valuePredicate); + public boolean containsHeaderString(String name, String valueSeparatorRegex, Predicate<String> valuePredicate); /** * Get the allowed HTTP methods from the Allow HTTP header.
diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/core/HttpHeaders.java b/jaxrs-api/src/main/java/jakarta/ws/rs/core/HttpHeaders.java index 782afb5..8895d75 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/core/HttpHeaders.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/core/HttpHeaders.java
@@ -69,12 +69,13 @@ * class or using its {@code toString} method if a header delegate is not available. * * <p> - * For example: {@code containsHeaderString("cache-control", "no-store"::equalsIgnoreCase)} will return {@code true} if + * For example: {@code containsHeaderString("cache-control", null, "no-store"::equalsIgnoreCase)} will return {@code true} if * a {@code Cache-Control} header exists that has the value {@code no-store}, the value {@code No-Store} or the value * {@code Max-Age, NO-STORE, no-transform}, but {@code false} when it has the value {@code no-store;no-transform} * (missing comma), or the value {@code no - store} (whitespace within value). * * @param name the message header. + * @param valueSeparatorRegex Separates the header value into single values. Defaults to {@code \s*,\s*} when {@code null}. * @param valuePredicate value must fulfil this predicate. * @return {@code true} if and only if a header with the given name exists, having either a whitespace-trimmed value * matching the predicate, or having at least one whitespace-trimmed single value in a comma-separated list of single values. @@ -82,7 +83,7 @@ * @see #getHeaderString(String) * @since 4.0 */ - public boolean containsHeaderString(String name, Predicate<String> valuePredicate); + public boolean containsHeaderString(String name, String valuleSeparatorRegex, Predicate<String> valuePredicate); /** * Get the values of HTTP request headers. The returned Map is case-insensitive wrt. keys and is read-only. The method