类 ServletServerHttpRequest
- java.lang.Object
- org.springframework.http.server.ServletServerHttpRequest
- 所有已实现的接口:
HttpInputMessage
,HttpMessage
,HttpRequest
,ServerHttpRequest
public class ServletServerHttpRequest extends Object implements ServerHttpRequest
ServerHttpRequest
implementation that is based on aHttpServletRequest
.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 protected static String
FORM_CHARSET
protected static String
FORM_CONTENT_TYPE
构造器概要
构造器 构造器 说明 ServletServerHttpRequest(HttpServletRequest servletRequest)
Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ServerHttpAsyncRequestControl
getAsyncRequestControl(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.InputStream
getBody()
Return the body of the message as an input stream.HttpHeaders
getHeaders()
Return the headers of this message.InetSocketAddress
getLocalAddress()
Return the address on which the request was received.HttpMethod
getMethod()
Return the HTTP method of the request.Principal
getPrincipal()
Return aPrincipal
instance containing the name of the authenticated user.InetSocketAddress
getRemoteAddress()
Return the address of the remote client.HttpServletRequest
getServletRequest()
Returns theHttpServletRequest
this object is based on.URI
getURI()
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).
字段详细资料
FORM_CONTENT_TYPE
protected static final String FORM_CONTENT_TYPE
- 另请参阅:
- 常量字段值
FORM_CHARSET
protected static final String FORM_CHARSET
- 另请参阅:
- 常量字段值
构造器详细资料
ServletServerHttpRequest
public ServletServerHttpRequest(HttpServletRequest servletRequest)
Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest
.- 参数:
servletRequest
- the servlet request
方法详细资料
getServletRequest
public HttpServletRequest getServletRequest()
Returns theHttpServletRequest
this object is based on.
getMethod
public HttpMethod getMethod()
从接口复制的说明:HttpRequest
Return the HTTP method of the request.- 指定者:
getMethod
在接口中HttpRequest
- 返回:
- the HTTP method as an HttpMethod enum value, or
null
if not resolvable (e.g. in case of a non-standard HTTP method)
getURI
public URI getURI()
从接口复制的说明:HttpRequest
Return the URI of the request (including a query string if any, but only if it is well-formed for a URI representation).- 指定者:
getURI
在接口中HttpRequest
- 返回:
- the URI of the request (never
null
)
getHeaders
public HttpHeaders getHeaders()
从接口复制的说明:HttpMessage
Return the headers of this message.- 指定者:
getHeaders
在接口中HttpMessage
- 返回:
- a corresponding HttpHeaders object (never
null
)
getPrincipal
public Principal getPrincipal()
从接口复制的说明:ServerHttpRequest
Return aPrincipal
instance containing the name of the authenticated user.If the user has not been authenticated, the method returns
null
.- 指定者:
getPrincipal
在接口中ServerHttpRequest
getLocalAddress
public InetSocketAddress getLocalAddress()
从接口复制的说明:ServerHttpRequest
Return the address on which the request was received.- 指定者:
getLocalAddress
在接口中ServerHttpRequest
getRemoteAddress
public InetSocketAddress getRemoteAddress()
从接口复制的说明:ServerHttpRequest
Return the address of the remote client.- 指定者:
getRemoteAddress
在接口中ServerHttpRequest
getBody
public InputStream getBody() throws IOException
从接口复制的说明:HttpInputMessage
Return the body of the message as an input stream.- 指定者:
getBody
在接口中HttpInputMessage
- 返回:
- the input stream body (never
null
) - 抛出:
IOException
- in case of I/O errors
getAsyncRequestControl
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response)
从接口复制的说明: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.- 指定者:
getAsyncRequestControl
在接口中ServerHttpRequest