public enum HttpUtil extends Enum<HttpUtil>
Tool that can be used to deal with an HTTP request state to know if GZIP is supported and then write according to
this information a ConvertibleNut
to the HTTP response.
Enum Constant and Description |
---|
INSTANCE
Singleton.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canGzip(HttpServletRequest request)
Indicates if the given
HttpServletRequest supports GZIP or not. |
static HttpUtil |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static HttpUtil[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
void |
write(ConvertibleNut nut,
HttpServletResponse response)
Serves the given nut by changing the specified response's state.
|
public static final HttpUtil INSTANCE
public static HttpUtil[] values()
for (HttpUtil c : HttpUtil.values()) System.out.println(c);
public static HttpUtil valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean canGzip(HttpServletRequest request)
Indicates if the given HttpServletRequest
supports GZIP or not.
request
- the request indicating GZIP supporttrue
if GZIP is supported, false
otherwisepublic void write(ConvertibleNut nut, HttpServletResponse response) throws IOException
Serves the given nut by changing the specified response's state. The method sets headers and writes response.
nut
- the nut to writeresponse
- the responseIOException
- if stream could not be openedCopyright © 2012-2015. All Rights Reserved.