Top Description Methods
jakarta.servlet

public Interface AsyncListener

extends EventListener
Imports
java.io.IOException, java.util.EventListener

Listener that will be notified in the event that an asynchronous operation initiated on a ServletRequest to which the listener had been added has completed, timed out, or resulted in an error.
Since
Servlet 3.0

Method Summary

Modifier and TypeMethod and Description
public void
onComplete(AsyncEvent
the AsyncEvent indicating that an asynchronous operation has been completed
event
)

Notifies this AsyncListener that an asynchronous operation has been completed.

public void
onError(AsyncEvent
the AsyncEvent indicating that an asynchronous operation has failed to complete
event
)

Notifies this AsyncListener that an asynchronous operation has failed to complete.

public void
onStartAsync(AsyncEvent
the AsyncEvent indicating that a new asynchronous cycle is being initiated
event
)

Notifies this AsyncListener that a new asynchronous cycle is being initiated via a call to one of the ServletRequest#startAsync methods.

public void
onTimeout(AsyncEvent
the AsyncEvent indicating that an asynchronous operation has timed out
event
)

Notifies this AsyncListener that an asynchronous operation has timed out.

Method Detail

onCompleteback to summary
public void onComplete(AsyncEvent event) throws IOException

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 calling getAsyncContext 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 calling getSuppliedRequest and getSuppliedResponse, respectively, on the given event.

Parameters
event:AsyncEvent

the AsyncEvent indicating that an asynchronous operation has been completed

Exceptions
IOException:
if an I/O related error has occurred during the processing of the given AsyncEvent
onErrorback to summary
public void onError(AsyncEvent event) throws IOException

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 calling getAsyncContext 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 calling getSuppliedRequest and getSuppliedResponse, respectively, on the given event.

Parameters
event:AsyncEvent

the AsyncEvent indicating that an asynchronous operation has failed to complete

Exceptions
IOException:
if an I/O related error has occurred during the processing of the given AsyncEvent
onStartAsyncback to summary
public void onStartAsync(AsyncEvent event) throws IOException

Notifies this AsyncListener that a new asynchronous cycle is being initiated via a call to one of the ServletRequest#startAsync methods.

The AsyncContext corresponding to the asynchronous operation that is being reinitialized may be obtained by calling getAsyncContext 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 calling getSuppliedRequest and getSuppliedResponse, 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) with the AsyncContext that is delivered as part of the given AsyncEvent.

Parameters
event:AsyncEvent

the AsyncEvent indicating that a new asynchronous cycle is being initiated

Exceptions
IOException:
if an I/O related error has occurred during the processing of the given AsyncEvent
onTimeoutback to summary
public void onTimeout(AsyncEvent event) throws IOException

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 calling getAsyncContext 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 calling getSuppliedRequest and getSuppliedResponse, respectively, on the given event.

Parameters
event:AsyncEvent

the AsyncEvent indicating that an asynchronous operation has timed out

Exceptions
IOException:
if an I/O related error has occurred during the processing of the given AsyncEvent