|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.gadgets.uri.UriUtils
public final class UriUtils
Utility functions related to URI and Http servlet response management.
| Nested Class Summary | |
|---|---|
static class |
UriUtils.DisallowedHeaders
Enum of disallowed response headers that should not be passed on as is to the user. |
| Field Summary | |
|---|---|
static String |
CHARSET
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CHARSET
| Method Detail |
|---|
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 request
public 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||