public final class HttpUtils extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static String[] |
DATE_FORMATS
Request header date formats as specified in the HTTP RFC
|
| Modifier and Type | Method and Description |
|---|---|
static String[] |
extractAuthorizationBasicCredentials(String header)
Extract credentials from a Basic Authorization header, if valid
|
static String |
extractAuthorizationBearer(String header)
Try to extract the value of a Bearer Authorization header
|
static List<Locale> |
getAcceptLanguageLocales(String header)
Try to get a list of
Locale from HTTP request from HttpHeaders.ACCEPT_LANGUAGE header, if not
null. |
static Map<String,List<String>> |
getAsMultiMap(Object payload)
Try to obtain given payload Object as a String multi map
|
static boolean |
isBasicAuthorizationHeader(String header)
Check if given header value is a Basic authorization header
|
static boolean |
isBearerAuthorizationHeader(String header)
Check if given header value is a Bearer authorization header
|
static boolean |
isEmpty(String headerValue)
Check if given value is null or empty
|
static boolean |
isSecure(URI uri)
Check if given URI is "secure", i.e.
|
static Date |
parseHeaderDate(String headerValue)
Get a header date value as
Date |
public static final String[] DATE_FORMATS
public static boolean isSecure(URI uri)
uri - URI to checktrue if URI has HTTPS as schemepublic static Date parseHeaderDate(String headerValue)
DateheaderValue - Headernull if header is null or invalidpublic static List<Locale> getAcceptLanguageLocales(String header)
Locale from HTTP request from HttpHeaders.ACCEPT_LANGUAGE header, if not
null. If more than one language is specified in Accept-Language header, returned Locales will be ordered relying
on quality parameter, if specified.header - Accept-Language headerpublic static boolean isBearerAuthorizationHeader(String header)
header - Header valuetrue if header starts with Bearer prefixpublic static boolean isBasicAuthorizationHeader(String header)
header - Header valuetrue if header starts with Basic prefixpublic static String extractAuthorizationBearer(String header)
header - Header valuenull if header is null or invalidpublic static String[] extractAuthorizationBasicCredentials(String header)
header - Header valuepublic static Map<String,List<String>> getAsMultiMap(Object payload)
payload - Payload (may be null)public static boolean isEmpty(String headerValue)
headerValue - Header valuetrue if value is null or emptyCopyright © 2019 The Holon Platform. All rights reserved.