-
- All Superinterfaces:
- EventListener
public interface AsyncListener extends 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
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description 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.
-
-
-
Method Detail
-
onComplete
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 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
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 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
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 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
void onStartAsync(AsyncEvent event) throws IOException
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.- 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
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 13:02:20 Cette version de la page est en cache (à la date du 21/08/2025 13:02:20) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/servlet/AsyncListener.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.