|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.gwt.user.server.rpc.RPCServletUtils
public class RPCServletUtils
Utility class containing helper methods used by servlets that integrate with the RPC system.
| Method Summary | |
|---|---|
static boolean |
acceptsGzipEncoding(javax.servlet.http.HttpServletRequest request)
Returns true if the HttpServletRequest accepts Gzip
encoding. |
static boolean |
exceedsUncompressedContentLengthLimit(java.lang.String content)
Returns true if the response content's estimated UTF-8 byte
length exceeds 256 bytes. |
static java.lang.String |
readContentAsUtf8(javax.servlet.http.HttpServletRequest request)
Returns the content of an HttpServletRequest by decoding it using
the UTF-8 charset. |
static boolean |
shouldGzipResponseContent(javax.servlet.http.HttpServletRequest request,
java.lang.String responseContent)
Returns true if the request accepts gzip encoding and the
the response content's estimated UTF-8 byte length exceeds 256 bytes. |
static void |
writeResponse(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletResponse response,
java.lang.String responseContent,
boolean gzipResponse)
Write the response content into the HttpServletResponse. |
static void |
writeResponseForUnexpectedFailure(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletResponse response,
java.lang.Throwable failure)
Called when the servlet itself has a problem, rather than the invoked third-party method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean acceptsGzipEncoding(javax.servlet.http.HttpServletRequest request)
true if the HttpServletRequest accepts Gzip
encoding. This is done by checking that the accept-encoding header
specifies gzip as a supported encoding.
request - the request instance to test for gzip encoding acceptance
true if the HttpServletRequest accepts Gzip
encodingpublic static boolean exceedsUncompressedContentLengthLimit(java.lang.String content)
true if the response content's estimated UTF-8 byte
length exceeds 256 bytes.
content - the contents of the response
true if the response content's estimated UTF-8 byte
length exceeds 256 bytes
public static java.lang.String readContentAsUtf8(javax.servlet.http.HttpServletRequest request)
throws java.io.IOException,
javax.servlet.ServletException
HttpServletRequest by decoding it using
the UTF-8 charset.
request - the servlet request whose content we want to read
HttpServletRequest by decoding it using
the UTF-8 charset
java.io.IOException - if the requests input stream cannot be accessed, read
from or closed
javax.servlet.ServletException - if the content length of the request is not
specified of if the request's content type is not
'text/x-gwt-rpc' and 'charset=utf-8'
public static boolean shouldGzipResponseContent(javax.servlet.http.HttpServletRequest request,
java.lang.String responseContent)
true if the request accepts gzip encoding and the
the response content's estimated UTF-8 byte length exceeds 256 bytes.
request - the request associated with the response contentresponseContent - a string that will be
true if the request accepts gzip encoding and the
the response content's estimated UTF-8 byte length exceeds 256
bytes
public static void writeResponse(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletResponse response,
java.lang.String responseContent,
boolean gzipResponse)
throws java.io.IOException
HttpServletResponse. If
gzipResponse is true, the response content
will be gzipped prior to being written into the response.
servletContext - servlet context for this responseresponse - response instanceresponseContent - a string containing the response contentgzipResponse - if true the response content will be
gzip encoded before being written into the response
java.io.IOException - if reading, writing, or closing the response's output
stream fails
public static void writeResponseForUnexpectedFailure(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletResponse response,
java.lang.Throwable failure)
servletContext - response - failure -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||