类 ServletServerHttpRequest
- java.lang.Object
- org.springframework.http.server.ServletServerHttpRequest
- 所有已实现的接口:
HttpInputMessage,HttpMessage,HttpRequest,ServerHttpRequest
public class ServletServerHttpRequest extends Object implements ServerHttpRequest
ServerHttpRequestimplementation that is based on aHttpServletRequest.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Rossen Stoyanchev, Juergen Hoeller
字段概要
字段 修饰符和类型 字段 说明 protected static CharsetFORM_CHARSETprotected static StringFORM_CONTENT_TYPE
构造器概要
构造器 构造器 说明 ServletServerHttpRequest(HttpServletRequest servletRequest)Construct a new instance of the ServletServerHttpRequest based on the givenHttpServletRequest.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ServerHttpAsyncRequestControlgetAsyncRequestControl(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.InputStreamgetBody()Return the body of the message as an input stream.HttpHeadersgetHeaders()Return the headers of this message.InetSocketAddressgetLocalAddress()Return the address on which the request was received.HttpMethodgetMethod()Return the HTTP method of the request.StringgetMethodValue()Return the HTTP method of the request as a String value.PrincipalgetPrincipal()Return aPrincipalinstance containing the name of the authenticated user.InetSocketAddressgetRemoteAddress()Return the address of the remote client.HttpServletRequestgetServletRequest()Returns theHttpServletRequestthis object is based on.URIgetURI()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 Charset 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 theHttpServletRequestthis object is based on.
getMethod
@Nullable public HttpMethod getMethod()
从接口复制的说明:HttpRequestReturn the HTTP method of the request.- 指定者:
getMethod在接口中HttpRequest- 返回:
- the HTTP method as an HttpMethod enum value, or
nullif not resolvable (e.g. in case of a non-standard HTTP method) - 另请参阅:
HttpRequest.getMethodValue(),HttpMethod.resolve(String)
getMethodValue
public String getMethodValue()
从接口复制的说明:HttpRequestReturn the HTTP method of the request as a String value.- 指定者:
getMethodValue在接口中HttpRequest- 返回:
- the HTTP method as a plain String
- 另请参阅:
HttpRequest.getMethod()
getURI
public URI getURI()
从接口复制的说明:HttpRequestReturn 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()
从接口复制的说明:HttpMessageReturn the headers of this message.- 指定者:
getHeaders在接口中HttpMessage- 返回:
- a corresponding HttpHeaders object (never
null)
getPrincipal
public Principal getPrincipal()
从接口复制的说明:ServerHttpRequestReturn aPrincipalinstance containing the name of the authenticated user.If the user has not been authenticated, the method returns
null.- 指定者:
getPrincipal在接口中ServerHttpRequest
getLocalAddress
public InetSocketAddress getLocalAddress()
从接口复制的说明:ServerHttpRequestReturn the address on which the request was received.- 指定者:
getLocalAddress在接口中ServerHttpRequest
getRemoteAddress
public InetSocketAddress getRemoteAddress()
从接口复制的说明:ServerHttpRequestReturn the address of the remote client.- 指定者:
getRemoteAddress在接口中ServerHttpRequest
getBody
public InputStream getBody() throws IOException
从接口复制的说明:HttpInputMessageReturn 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)
从接口复制的说明: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.- 指定者:
getAsyncRequestControl在接口中ServerHttpRequest