public final class HttpHeaderHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkVitamHeaders(javax.ws.rs.core.HttpHeaders headers)
Check specific vitam headers values with regular expression from the (define in
VitamHttpHeader) At the
first wrong value, treatment stops and throws an IllegalStateException Note that, the regular expression
is case insensitive. |
static void |
checkVitamHeadersMap(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
Check specific vitam headers values with regular expression from the (define in
VitamHttpHeader) At the
first wrong value, treatment stops and throws an IllegalStateException Note that, the regular expression
is case insensitive. |
static List<String> |
getHeaderValues(javax.ws.rs.core.HttpHeaders headers,
String name)
Retrieve header values from
HttpHeaders for VitamHttpHeader |
static List<String> |
getHeaderValues(javax.ws.rs.core.HttpHeaders headers,
VitamHttpHeader name)
Get header values from
HttpHeaders for VitamHttpHeader |
static boolean |
hasValuesFor(javax.ws.rs.core.HttpHeaders headers,
VitamHttpHeader vitamHeader)
Check if headers are declared
|
static void |
validateHeaderValue(javax.ws.rs.core.HttpHeaders headers,
javax.ws.rs.core.MultivaluedHashMap<String,String> wantedHeaders)
Validate HTTP header values.
|
public static List<String> getHeaderValues(javax.ws.rs.core.HttpHeaders headers, VitamHttpHeader name)
HttpHeaders for VitamHttpHeaderheaders - the headers listname - the VitamHttpHeader with wanted header nameIllegalArgumentException - if headers or name is nullpublic static List<String> getHeaderValues(javax.ws.rs.core.HttpHeaders headers, String name)
HttpHeaders for VitamHttpHeaderheaders - the headers listname - the header nameIllegalArgumentException - if headers is null or name is null or emptypublic static boolean hasValuesFor(javax.ws.rs.core.HttpHeaders headers,
VitamHttpHeader vitamHeader)
headers - the headers list to checkvitamHeader - the header to retreiveIllegalArgumentException - if headers or vitamHeader is nullpublic static void checkVitamHeaders(javax.ws.rs.core.HttpHeaders headers)
VitamHttpHeader) At the
first wrong value, treatment stops and throws an IllegalStateException Note that, the regular expression
is case insensitive.headers - HTTP headers list to checkIllegalStateException - when a header value doesn't match with teh defined regular expressionIllegalArgumentException - if headers is nullpublic static void checkVitamHeadersMap(javax.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
VitamHttpHeader) At the
first wrong value, treatment stops and throws an IllegalStateException Note that, the regular expression
is case insensitive.requestHeaders - HTTP headers list to checkIllegalStateException - when a header value doesn't match with the defined regular expressionpublic static void validateHeaderValue(javax.ws.rs.core.HttpHeaders headers,
javax.ws.rs.core.MultivaluedHashMap<String,String> wantedHeaders)
VitamHttpHeader then check if format matches with
the defined regular expression. Also check the wantedHeaders map values with VitamHttpHeader. Values of
headers (from HTTP or from wanted list) can not be null (throw an exception).
In case of error, the exception contains all errors in its message.headers - the headers list to validatewantedHeaders - the map representing wanted header values with the key for header name and the value (list)
for the wanted values for this specific header nameIllegalArgumentException - if headers is nullIllegalStateException - if one or more header values does not equal to wanted values, header values do not
match with the defined regular expression, wanted values for a header are null, header values are null.
This exception contains all errors in its message.Copyright © 2018 Vitam. All rights reserved.