@ThreadSafe public class ServletUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
applyHTTPResponse(HTTPResponse httpResponse,
javax.servlet.http.HttpServletResponse servletResponse)
Applies the status code, headers and content of the specified HTTP
response to a HTTP servlet response.
|
static HTTPRequest |
createHTTPRequest(javax.servlet.http.HttpServletRequest sr)
Creates a new HTTP request from the specified HTTP servlet request.
|
static HTTPRequest |
createHTTPRequest(javax.servlet.http.HttpServletRequest sr,
long maxEntityLength)
Creates a new HTTP request from the specified HTTP servlet request.
|
public static HTTPRequest createHTTPRequest(javax.servlet.http.HttpServletRequest sr) throws IOException
Warning about servlet filters: Processing of
HTTP POST and PUT requests requires the entity body to be available
for reading from the HttpServletRequest. If you're getting
unexpected exceptions, please ensure the entity body is not consumed
or modified by an upstream servlet filter.
sr - The servlet request. Must not be null.IllegalArgumentException - The the servlet request method is
not GET, POST, PUT or DELETE or the
content type header value couldn't
be parsed.IOException - For a POST or PUT body that
couldn't be read due to an I/O
exception.public static HTTPRequest createHTTPRequest(javax.servlet.http.HttpServletRequest sr, long maxEntityLength) throws IOException
Warning about servlet filters: Processing of
HTTP POST and PUT requests requires the entity body to be available
for reading from the HttpServletRequest. If you're getting
unexpected exceptions, please ensure the entity body is not consumed
or modified by an upstream servlet filter.
sr - The servlet request. Must not be
null.maxEntityLength - The maximum entity length to accept, -1 for
no limit.IllegalArgumentException - The the servlet request method is
not GET, POST, PUT or DELETE or the
content type header value couldn't
be parsed.IOException - For a POST or PUT body that
couldn't be read due to an I/O
exception.public static void applyHTTPResponse(HTTPResponse httpResponse, javax.servlet.http.HttpServletResponse servletResponse) throws IOException
httpResponse - The HTTP response. Must not be null.servletResponse - The HTTP servlet response. Must not be
null.IOException - If the response content couldn't be written.Copyright © 2017 Connect2id Ltd.. All rights reserved.