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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionServletServerHttpRequest(jakarta.servlet.http.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.Return a mutable map of request attributes for this request.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 aPrincipalinstance containing the name of the authenticated user.Return the address of the remote client.jakarta.servlet.http.HttpServletRequestReturns theHttpServletRequestthis 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).static URIinitURI(jakarta.servlet.http.HttpServletRequest servletRequest) Initialize a URI from the given Servlet request.
-
Field Details
-
FORM_CHARSET
-
-
Constructor Details
-
ServletServerHttpRequest
public ServletServerHttpRequest(jakarta.servlet.http.HttpServletRequest servletRequest) Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest.- Parameters:
servletRequest- the servlet request
-
-
Method Details
-
getServletRequest
public jakarta.servlet.http.HttpServletRequest getServletRequest()Returns theHttpServletRequestthis object is based on. -
getMethod
Description copied from interface:HttpRequestReturn the HTTP method of the request.- Specified by:
getMethodin interfaceHttpRequest- Returns:
- the HTTP method as an HttpMethod value
- See Also:
-
getURI
Description copied from interface:HttpRequestReturn the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).- Specified by:
getURIin interfaceHttpRequest- Returns:
- the URI of the request (never
null)
-
initURI
Initialize a URI from the given Servlet request.- Parameters:
servletRequest- the request- Returns:
- the initialized URI
- Since:
- 6.1
-
getHeaders
Description copied from interface:HttpMessageReturn the headers of this message.- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a corresponding HttpHeaders object (never
null)
-
getPrincipal
Description copied from interface:ServerHttpRequestReturn aPrincipalinstance containing the name of the authenticated user.If the user has not been authenticated, the method returns
null.- Specified by:
getPrincipalin interfaceServerHttpRequest
-
getLocalAddress
Description copied from interface:ServerHttpRequestReturn the address on which the request was received.- Specified by:
getLocalAddressin interfaceServerHttpRequest
-
getRemoteAddress
Description copied from interface:ServerHttpRequestReturn the address of the remote client.- Specified by:
getRemoteAddressin interfaceServerHttpRequest
-
getAttributes
Description copied from interface:HttpRequestReturn a mutable map of request attributes for this request.- Specified by:
getAttributesin interfaceHttpRequest
-
getBody
Description copied from interface:HttpInputMessageReturn the body of the message as an input stream.- Specified by:
getBodyin interfaceHttpInputMessage- Returns:
- the input stream body (never
null) - Throws:
IOException- in case of I/O errors
-
getAsyncRequestControl
Description copied from interface:ServerHttpRequestReturn 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:
getAsyncRequestControlin interfaceServerHttpRequest
-