public final class ContextHelper extends Object implements HttpConstants
HttpConstants.HTTP_METHOD
ACCEPT_HEADER, ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER, ACCESS_CONTROL_ALLOW_HEADERS_HEADER, ACCESS_CONTROL_ALLOW_METHODS_HEADER, ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, ACCESS_CONTROL_EXPOSE_HEADERS_HEADER, ACCESS_CONTROL_MAX_AGE_HEADER, AJAX_HEADER_NAME, AJAX_HEADER_VALUE, APPLICATION_FORM_ENCODED_HEADER_VALUE, APPLICATION_JSON, AUTHENTICATE_HEADER, AUTHORIZATION_HEADER, BAD_REQUEST, BASIC_HEADER_PREFIX, BEARER_HEADER_PREFIX, CONTENT_TYPE_HEADER, CREATED, DEFAULT_CONNECT_TIMEOUT, DEFAULT_HTTP_PORT, DEFAULT_HTTPS_PORT, DEFAULT_READ_TIMEOUT, DIGEST_HEADER_PREFIX, FACES_PARTIAL_AJAX_PARAMETER, FORBIDDEN, HTML_CONTENT_TYPE, LOCATION_HEADER, NO_CONTENT, OK, SCHEME_HTTP, SCHEME_HTTPS, TEMP_REDIRECT, UNAUTHORIZED
Constructor and Description |
---|
ContextHelper() |
Modifier and Type | Method and Description |
---|---|
static Cookie |
getCookie(Collection<Cookie> cookies,
String name)
Get a specific cookie by its name.
|
static Cookie |
getCookie(WebContext context,
String name)
Get a specific cookie by its name.
|
static boolean |
isGet(WebContext context)
Whether it is a GET request.
|
static boolean |
isHttp(WebContext context)
Whether the request is HTTP.
|
static boolean |
isHttps(WebContext context)
Whether the request is HTTPS.
|
static boolean |
isHttpsOrSecure(WebContext context)
Whether the request is HTTPS or secure.
|
static boolean |
isPost(WebContext context)
Whether it is a POST request.
|
public static Cookie getCookie(Collection<Cookie> cookies, String name)
cookies
- provided cookiesname
- the name of the cookiepublic static Cookie getCookie(WebContext context, String name)
context
- the current web contextname
- the name of the cookiepublic static boolean isGet(WebContext context)
context
- the web contextpublic static boolean isPost(WebContext context)
context
- the web contextpublic static boolean isHttpsOrSecure(WebContext context)
context
- the current web contextpublic static boolean isHttp(WebContext context)
context
- the current web contextpublic static boolean isHttps(WebContext context)
context
- the current web contextCopyright © 2018. All rights reserved.