In this section, you will learn about the important methods of AsyncEvent Class.
When an asynchronous events occurs, AsyncListener will receive an AsyncEvent . AsyncEvent contains the details of asynchronous events.
AsyncEvent contains the details of the event occurred by the asynchronous processes. These events includes successfully completion of asynchronous cycle, times out, or results in an error . The AsyncListener will receive an AsyncEvent (asynchronous event object) when the above events(i.e. completion of asynchronous cycle, times out, or results in an error) occurs.
The AsyncListener will be notified in their creation/addition order. These events occurrence notification helps you in defining code according to your need for asynchronous processing.
The essential methods / functions of AsyncEvent Class is given below :
|getAsyncContext()||Using this method, you can obtain AsyncContext of this AsyncEvent which was employed to initialize it.|
|getSuppliedRequest()||Using this function, you can obtain ServletRequest of this AsyncEvent which was utilized to employed it.|
|getSuppliedResponse()||Using this function, you can obtain ServletResponse of this AsyncEvent which was utilized to employed it.|
|getThrowable()||This function returns the Throwable that was employed to initialize AsyncEvent, it returns null if the AsyncEvent was initialized without any Throwable.|
Liked it! Share this Tutorial