Package org.springframework.http.server
Class ServletServerHttpRequest
java.lang.Object
org.springframework.http.server.ServletServerHttpRequest
- All Implemented Interfaces:
HttpInputMessage
,HttpMessage
,HttpRequest
,ServerHttpRequest
- Direct Known Subclasses:
RequestPartServletServerHttpRequest
ServerHttpRequest
implementation that is based on a HttpServletRequest
.- Since:
- 3.0
- Author:
- Arjen Poutsma, Rossen Stoyanchev, Juergen Hoeller
-
Field Summary
-
Constructor Summary
ConstructorDescriptionServletServerHttpRequest
(HttpServletRequest servletRequest) Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest
. -
Method Summary
Modifier and TypeMethodDescriptiongetAsyncRequestControl
(ServerHttpResponse response) Return a control that allows putting the request in asynchronous mode so the response remains open until closed explicitly from the current or another thread.getBody()
Return the body of the message as an input stream.Return the headers of this message.Return the address on which the request was received.Return the HTTP method of the request.Return aPrincipal
instance containing the name of the authenticated user.Return the address of the remote client.Returns theHttpServletRequest
this object is based on.getURI()
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).
-
Field Details
-
FORM_CHARSET
-
-
Constructor Details
-
ServletServerHttpRequest
Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest
.- Parameters:
servletRequest
- the servlet request
-
-
Method Details
-
getServletRequest
Returns theHttpServletRequest
this object is based on. -
getMethod
Description copied from interface:HttpRequest
Return the HTTP method of the request.- Specified by:
getMethod
in interfaceHttpRequest
- Returns:
- the HTTP method as an HttpMethod value
- See Also:
-
getURI
Description copied from interface:HttpRequest
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).- Specified by:
getURI
in interfaceHttpRequest
- Returns:
- the URI of the request (never
null
)
-
getHeaders
Description copied from interface:HttpMessage
Return the headers of this message.- Specified by:
getHeaders
in interfaceHttpMessage
- Returns:
- a corresponding HttpHeaders object (never
null
)
-
getPrincipal
Description copied from interface:ServerHttpRequest
Return aPrincipal
instance containing the name of the authenticated user.If the user has not been authenticated, the method returns
null
.- Specified by:
getPrincipal
in interfaceServerHttpRequest
-
getLocalAddress
Description copied from interface:ServerHttpRequest
Return the address on which the request was received.- Specified by:
getLocalAddress
in interfaceServerHttpRequest
-
getRemoteAddress
Description copied from interface:ServerHttpRequest
Return the address of the remote client.- Specified by:
getRemoteAddress
in interfaceServerHttpRequest
-
getBody
Description copied from interface:HttpInputMessage
Return the body of the message as an input stream.- Specified by:
getBody
in interfaceHttpInputMessage
- Returns:
- the input stream body (never
null
) - Throws:
IOException
- in case of I/O errors
-
getAsyncRequestControl
Description copied from interface:ServerHttpRequest
Return a control that allows putting the request in asynchronous mode so the response remains open until closed explicitly from the current or another thread.- Specified by:
getAsyncRequestControl
in interfaceServerHttpRequest
-