Interface AsyncListener
- All Superinterfaces:
EventListener
- Since:
- Servlet 3.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Method Details
-
onComplete
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.- Parameters:
event
- the AsyncEvent indicating that an asynchronous operation has been completed- Throws:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
-
onTimeout
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.- Parameters:
event
- the AsyncEvent indicating that an asynchronous operation has timed out- Throws:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
-
onError
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.- Parameters:
event
- the AsyncEvent indicating that an asynchronous operation has failed to complete- Throws:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
-
onStartAsync
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(jakarta.servlet.AsyncListener)
) with the AsyncContext that is delivered as part of the given AsyncEvent.- Parameters:
event
- the AsyncEvent indicating that a new asynchronous cycle is being initiated- Throws:
IOException
- if an I/O related error has occurred during the processing of the given AsyncEvent
-