|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.gadgets.servlet.ServletUtil
public final class ServletUtil
Jtility routines for dealing with servlets.
| Field Summary | |
|---|---|
static String |
DATA_URI_KEY
|
static String |
REMOTE_ADDR_KEY
|
| Method Summary | |
|---|---|
static HttpResponse |
convertToJsonResponse(HttpResponse response)
Converts the given HttpResponse into JSON form, with at least
one field, dataUri, containing a Data URI that can be inlined into an HTML page. |
static void |
copyResponseToServlet(HttpResponse response,
javax.servlet.http.HttpServletResponse servletResponse)
|
static HttpResponse |
errorResponse(GadgetException e)
|
static HttpRequest |
fromHttpServletRequest(javax.servlet.http.HttpServletRequest servletReq)
Returns an HttpRequest object encapsulating the servlet request. |
static void |
setCachingHeaders(HttpResponseBuilder response,
int ttl,
boolean noProxy)
|
static void |
setXForwardedForHeader(HttpRequest inboundRequest,
HttpRequest req)
Sets standard forwarding headers on the proxied request. |
static void |
setXForwardedForHeader(javax.servlet.http.HttpServletRequest inboundRequest,
HttpRequest req)
|
static Uri |
validateUrl(Uri urlToValidate)
Validates and normalizes the given url, ensuring that it is non-null, has scheme http or https, and has a path value of some kind. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String REMOTE_ADDR_KEY
public static final String DATA_URI_KEY
| Method Detail |
|---|
public static HttpRequest fromHttpServletRequest(javax.servlet.http.HttpServletRequest servletReq)
throws IOException
servletReq - The http servlet request.
IOException - In case of errors.
public static void setCachingHeaders(HttpResponseBuilder response,
int ttl,
boolean noProxy)
public static void copyResponseToServlet(HttpResponse response,
javax.servlet.http.HttpServletResponse servletResponse)
throws IOException
IOException
public static Uri validateUrl(Uri urlToValidate)
throws GadgetException
GadgetException - If the url is not valid.
public static void setXForwardedForHeader(HttpRequest inboundRequest,
HttpRequest req)
throws GadgetException
inboundRequest - req -
GadgetException
public static void setXForwardedForHeader(javax.servlet.http.HttpServletRequest inboundRequest,
HttpRequest req)
throws GadgetException
GadgetExceptionpublic static HttpResponse errorResponse(GadgetException e)
public static HttpResponse convertToJsonResponse(HttpResponse response)
throws IOException
HttpResponse into JSON form, with at least
one field, dataUri, containing a Data URI that can be inlined into an HTML page.
Any metadata on the given HttpResponse is also added as fields.
response - Input HttpResponse to convert to JSON.
IOException - If there are problems reading from response.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||