public class ServletServerHttpRequest extends java.lang.Object implements ServerHttpRequest
ServerHttpRequest
implementation that is based on a HttpServletRequest
.Modifier and Type | Field and Description |
---|---|
private Cookies |
cookies |
protected static java.lang.String |
FORM_CHARSET |
protected static java.lang.String |
FORM_CONTENT_TYPE |
private HttpHeaders |
headers |
private static java.lang.String |
METHOD_POST |
private MultiValueMap<java.lang.String,java.lang.String> |
queryParams |
private HttpServletRequest |
servletRequest |
Constructor and Description |
---|
ServletServerHttpRequest(HttpServletRequest servletRequest)
Construct a new instance of the ServletServerHttpRequest based on the given
HttpServletRequest . |
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getBody()
Return the body of the message as an input stream.
|
private java.io.InputStream |
getBodyFromServletRequestParameters(HttpServletRequest request)
Use
javax.servlet.ServletRequest#getParameterMap() to reconstruct the
body of a form 'POST' providing a predictable outcome as opposed to reading
from the body, which can fail if any other code has used ServletRequest
to access a parameter thus causing the input stream to be "consumed". |
Cookies |
getCookies()
TODO ..
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
HttpMethod |
getMethod()
Return the HTTP method of the request.
|
java.security.Principal |
getPrincipal()
Return a
Principal instance containing the name of the
authenticated user. |
MultiValueMap<java.lang.String,java.lang.String> |
getQueryParams()
Returns the map of query parameters.
|
java.lang.String |
getRemoteAddress()
Return the IP address of the endpoint on the other end.
|
java.lang.String |
getRemoteHostName()
Return the host name of the endpoint on the other end.
|
HttpServletRequest |
getServletRequest()
Returns the
HttpServletRequest this object is based on. |
java.net.URI |
getURI()
Return the URI of the request.
|
private boolean |
isFormPost(HttpServletRequest request) |
protected static final java.lang.String FORM_CONTENT_TYPE
protected static final java.lang.String FORM_CHARSET
private static final java.lang.String METHOD_POST
private final HttpServletRequest servletRequest
private HttpHeaders headers
private Cookies cookies
private MultiValueMap<java.lang.String,java.lang.String> queryParams
public ServletServerHttpRequest(HttpServletRequest servletRequest)
HttpServletRequest
.servletRequest
- the servlet requestpublic HttpServletRequest getServletRequest()
HttpServletRequest
this object is based on.public HttpMethod getMethod()
HttpRequest
getMethod
in interface HttpRequest
public java.net.URI getURI()
HttpRequest
getURI
in interface HttpRequest
public HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
public java.security.Principal getPrincipal()
ServerHttpRequest
Principal
instance containing the name of the
authenticated user. If the user has not been authenticated, the method returns
null
.getPrincipal
in interface ServerHttpRequest
public java.lang.String getRemoteHostName()
ServerHttpRequest
getRemoteHostName
in interface ServerHttpRequest
public java.lang.String getRemoteAddress()
ServerHttpRequest
getRemoteAddress
in interface ServerHttpRequest
public Cookies getCookies()
HttpMessage
getCookies
in interface HttpMessage
public MultiValueMap<java.lang.String,java.lang.String> getQueryParams()
ServerHttpRequest
getQueryParams
in interface ServerHttpRequest
public java.io.InputStream getBody() throws java.io.IOException
HttpInputMessage
getBody
in interface HttpInputMessage
java.io.IOException
- in case of I/O Errorsprivate boolean isFormPost(HttpServletRequest request)
private java.io.InputStream getBodyFromServletRequestParameters(HttpServletRequest request) throws java.io.IOException
javax.servlet.ServletRequest#getParameterMap()
to reconstruct the
body of a form 'POST' providing a predictable outcome as opposed to reading
from the body, which can fail if any other code has used ServletRequest
to access a parameter thus causing the input stream to be "consumed".java.io.IOException