public final class UriUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UriUtils.DisallowedHeaders
Enum of disallowed response headers that should not be passed on as is to
the user.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
copyRequestData(HttpRequest origRequest,
HttpRequest req)
Copies the post data from HttpServletRequest object to HttpRequest object.
|
static void |
copyRequestHeaders(HttpRequest origRequest,
HttpRequest req,
UriUtils.DisallowedHeaders... disallowedRequestHeaders)
Copies headers from HttpServletRequest object to HttpRequest object.
|
static void |
copyResponseHeadersAndStatusCode(HttpResponse data,
HttpResponseBuilder resp,
boolean remapInternalServerError,
boolean setHeaders,
UriUtils.DisallowedHeaders... disallowedResponseHeaders)
Copies the http response headers and status code to the final servlet
response.
|
static String |
getContentTypeWithoutCharset(String content)
Parses the value of content-type header and returns the content type header
without the 'charset' attribute.
|
static boolean |
isValidHeaderName(String name)
Returns true if the header name is valid.
|
static boolean |
isValidHeaderValue(String val)
Returns true if the header value is valid.
|
static void |
maybeRewriteContentType(HttpRequest req,
HttpResponseBuilder response)
Rewrite the content type of the final http response if the request has the
rewrite-mime-type param.
|
public static final String CHARSET
public static boolean isValidHeaderName(String name)
name - The header name.public static boolean isValidHeaderValue(String val)
val - The header value.public static void copyResponseHeadersAndStatusCode(HttpResponse data, HttpResponseBuilder resp, boolean remapInternalServerError, boolean setHeaders, UriUtils.DisallowedHeaders... disallowedResponseHeaders) throws IOException
data - The http response when fetching the requested accel uri.resp - The servlet response to return back to client.remapInternalServerError - If true, then SC_INTERNAL_SERVER_ERROR is
remapped to SC_BAD_GATEWAY.setHeaders - If true, then setHeader method of HttpServletResponse is
called, otherwise addHeader is called for every header.disallowedResponseHeaders - Disallowed response headers to omit from the response
returned to the user.IOException - In case the http response was not successful.public static void copyRequestHeaders(HttpRequest origRequest, HttpRequest req, UriUtils.DisallowedHeaders... disallowedRequestHeaders)
origRequest - Servlet request to copy headers from.req - The HttpRequest object to copy headers to.disallowedRequestHeaders - Disallowed request headers to omit from
the servlet requestpublic static void copyRequestData(HttpRequest origRequest, HttpRequest req) throws GadgetException
origRequest - Request to copy post data from.req - The HttpRequest object to copy post data to.GadgetException - In case of errors.public static void maybeRewriteContentType(HttpRequest req, HttpResponseBuilder response)
req - The http request.response - The final http response to be returned to user.public static String getContentTypeWithoutCharset(String content)
content - The content type header value.Copyright © 2007-2012. All Rights Reserved.