类 ServletServerHttpAsyncRequestControl
- java.lang.Object
- org.springframework.http.server.ServletServerHttpAsyncRequestControl
public class ServletServerHttpAsyncRequestControl extends Object implements ServerHttpAsyncRequestControl, AsyncListener
AServerHttpAsyncRequestControl
to use on Servlet containers (Servlet 3.0+).- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response)
Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequest
andServletServerHttpResponse
respectively.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
complete()
Mark asynchronous request processing as completed.boolean
isCompleted()
Return whether asynchronous request processing has been completed.boolean
isStarted()
Return whether asynchronous request processing has been started.void
onComplete(AsyncEvent event)
Notifies this AsyncListener that an asynchronous operation has been completed.void
onError(AsyncEvent event)
Notifies this AsyncListener that an asynchronous operation has failed to complete.void
onStartAsync(AsyncEvent event)
Notifies this AsyncListener that a new asynchronous cycle is being initiated via a call to one of theServletRequest.startAsync()
methods.void
onTimeout(AsyncEvent event)
Notifies this AsyncListener that an asynchronous operation has timed out.void
start()
Enable asynchronous processing after which the response remains open until a call toServerHttpAsyncRequestControl.complete()
is made or the server times out the request.void
start(long timeout)
A variation onServerHttpAsyncRequestControl.start()
that allows specifying a timeout value to use to use for asynchronous processing.
构造器详细资料
ServletServerHttpAsyncRequestControl
public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response)
Constructor accepting a request and response pair that are expected to be of typeServletServerHttpRequest
andServletServerHttpResponse
respectively.
方法详细资料
isStarted
public boolean isStarted()
从接口复制的说明:ServerHttpAsyncRequestControl
Return whether asynchronous request processing has been started.- 指定者:
isStarted
在接口中ServerHttpAsyncRequestControl
isCompleted
public boolean isCompleted()
从接口复制的说明:ServerHttpAsyncRequestControl
Return whether asynchronous request processing has been completed.- 指定者:
isCompleted
在接口中ServerHttpAsyncRequestControl
start
public void start()
从接口复制的说明:ServerHttpAsyncRequestControl
Enable asynchronous processing after which the response remains open until a call toServerHttpAsyncRequestControl.complete()
is made or the server times out the request. Once enabled, additional calls to this method are ignored.- 指定者:
start
在接口中ServerHttpAsyncRequestControl
start
public void start(long timeout)
从接口复制的说明:ServerHttpAsyncRequestControl
A variation onServerHttpAsyncRequestControl.start()
that allows specifying a timeout value to use to use for asynchronous processing. IfServerHttpAsyncRequestControl.complete()
is not called within the specified value, the request times out.- 指定者:
start
在接口中ServerHttpAsyncRequestControl
complete
public void complete()
从接口复制的说明:ServerHttpAsyncRequestControl
Mark asynchronous request processing as completed.- 指定者:
complete
在接口中ServerHttpAsyncRequestControl
onComplete
public void onComplete(AsyncEvent event) throws IOException
从接口复制的说明:javax.servlet.AsyncListener
Notifies this AsyncListener that an asynchronous operation has been completed.The
AsyncContext
corresponding to the asynchronous operation that has been completed may be obtained by callinggetAsyncContext
on the given event.In addition, if this AsyncListener had been registered via a call to
AsyncContext.addListener(AsyncListener, ServletRequest, ServletResponse)
, the supplied ServletRequest and ServletResponse objects may be retrieved by callinggetSuppliedRequest
andgetSuppliedResponse
, respectively, on the given event.- 指定者:
onComplete
在接口中AsyncListener
- 参数:
event
- the AsyncEvent indicating that an asynchronous operation has been completed- 抛出:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
onStartAsync
public void onStartAsync(AsyncEvent event) throws IOException
从接口复制的说明:javax.servlet.AsyncListener
Notifies this AsyncListener that a new asynchronous cycle is being initiated via a call to one of theServletRequest.startAsync()
methods.The
AsyncContext
corresponding to the asynchronous operation that is being reinitialized may be obtained by callinggetAsyncContext
on the given event.In addition, if this AsyncListener had been registered via a call to
AsyncContext.addListener(AsyncListener, ServletRequest, ServletResponse)
, the supplied ServletRequest and ServletResponse objects may be retrieved by callinggetSuppliedRequest
andgetSuppliedResponse
, respectively, on the given event.This AsyncListener will not receive any events related to the new asynchronous cycle unless it registers itself (via a call to
AsyncContext.addListener(javax.servlet.AsyncListener)
) with the AsyncContext that is delivered as part of the given AsyncEvent.- 指定者:
onStartAsync
在接口中AsyncListener
- 参数:
event
- the AsyncEvent indicating that a new asynchronous cycle is being initiated- 抛出:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
onError
public void onError(AsyncEvent event) throws IOException
从接口复制的说明:javax.servlet.AsyncListener
Notifies this AsyncListener that an asynchronous operation has failed to complete.The
AsyncContext
corresponding to the asynchronous operation that failed to complete may be obtained by callinggetAsyncContext
on the given event.In addition, if this AsyncListener had been registered via a call to
AsyncContext.addListener(AsyncListener, ServletRequest, ServletResponse)
, the supplied ServletRequest and ServletResponse objects may be retrieved by callinggetSuppliedRequest
andgetSuppliedResponse
, respectively, on the given event.- 指定者:
onError
在接口中AsyncListener
- 参数:
event
- the AsyncEvent indicating that an asynchronous operation has failed to complete- 抛出:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
onTimeout
public void onTimeout(AsyncEvent event) throws IOException
从接口复制的说明:javax.servlet.AsyncListener
Notifies this AsyncListener that an asynchronous operation has timed out.The
AsyncContext
corresponding to the asynchronous operation that has timed out may be obtained by callinggetAsyncContext
on the given event.In addition, if this AsyncListener had been registered via a call to
AsyncContext.addListener(AsyncListener, ServletRequest, ServletResponse)
, the supplied ServletRequest and ServletResponse objects may be retrieved by callinggetSuppliedRequest
andgetSuppliedResponse
, respectively, on the given event.- 指定者:
onTimeout
在接口中AsyncListener
- 参数:
event
- the AsyncEvent indicating that an asynchronous operation has timed out- 抛出:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent