public class RequestUtil extends Object
This class is not intended to be extended or instantiated because it just provides static utility methods not intended to be overwritten.
| Constructor and Description |
|---|
RequestUtil() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull String |
getServletName(@NotNull Servlet servlet)
Utility method to return a name for the given servlet.
|
static boolean |
handleIfModifiedSince(@NotNull SlingHttpServletRequest req,
@NotNull HttpServletResponse resp)
Checks if the request contains a if-last-modified-since header and if the the
request's underlying resource has a jcr:lastModified property.
|
static @NotNull Map<String,Double> |
parserAcceptHeader(@NotNull String value)
Parses an
Accept-* header of the form: |
static @NotNull Map<String,Map<String,String>> |
parserHeader(@NotNull String value)
Parses a header of the form:
|
static @Nullable Object |
setRequestAttribute(@NotNull HttpServletRequest request,
@NotNull String name,
Object value)
Sets the named request attribute to the new value and returns the
previous value.
|
@NotNull public static @NotNull Map<String,Map<String,String>> parserHeader(@NotNull @NotNull String value)
Header = Token { "," Token } .
Token = name { ";" Parameter } .
Parameter = name [ "=" value ] .
"," and ";" are not allowed within name and valuevalue - The header value@NotNull public static @NotNull Map<String,Double> parserAcceptHeader(@NotNull @NotNull String value)
Accept-* header of the form:
Header = Token { "," Token } .
Token = name { ";" "q" [ "=" value ] } .
Parameter = .
"," and ";" are not allowed within name and valuevalue - The header valueDouble instances providing the value of the
q parameter.@NotNull public static @NotNull String getServletName(@NotNull @NotNull Servlet servlet)
null,
non-empty name:
servlet - The servlet@Nullable public static @Nullable Object setRequestAttribute(@NotNull @NotNull HttpServletRequest request, @NotNull @NotNull String name, Object value)
request - The request object whose attribute is to be set.name - The name of the attribute to be set.value - The new value of the attribute. If this is null
the attribte is actually removed from the request.null if it was not set.public static boolean handleIfModifiedSince(@NotNull
@NotNull SlingHttpServletRequest req,
@NotNull
@NotNull HttpServletResponse resp)
req - the requestresp - the responsetrue if the response was setCopyright © 2010 - 2020 Adobe. All Rights Reserved