public class StandardServletAsyncWebRequest extends ServletWebRequest implements AsyncWebRequest, AsyncListenerEE
AsyncWebRequest
の Servlet 3.0 実装。 非同期リクエストに含まれるサーブレットとすべてのフィルターは、サーブレット API を使用するか、<async-supported>true</async-supported>
要素をサーブレットに追加して web.xml
のフィルター宣言を有効にして、非同期サポートを有効にする必要があります。
DESTRUCTION_CALLBACK_NAME_PREFIX, immutableValueTypes
requestDestructionCallbacks
REFERENCE_REQUEST, REFERENCE_SESSION, SCOPE_REQUEST, SCOPE_SESSION
コンストラクターと説明 |
---|
StandardServletAsyncWebRequest(HttpServletRequestEE request, HttpServletResponseEE response) 指定されたリクエスト / レスポンスペアの新しいインスタンスを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
void | addCompletionHandler(RunnableSE runnable) リクエスト処理が完了したときに呼び出すハンドラーを追加します。 |
void | addErrorHandler(ConsumerSE<ThrowableSE> exceptionHandler) リクエストの同時処理中にエラーが発生したときに呼び出すハンドラーを追加します。 |
void | addTimeoutHandler(RunnableSE timeoutHandler) 並行処理がタイムアウトしたときに呼び出すハンドラーを追加します。 |
void | dispatch() アプリケーションスレッドでの同時実行後に処理を再開するために、コンテナーにリクエストをディスパッチします。 |
boolean | isAsyncComplete() 非同期リクエスト処理が完了したかどうか。 |
boolean | isAsyncStarted() AsyncWebRequest.startAsync() の呼び出し後、リクエストが非同期モードかどうか。 |
void | onComplete(AsyncEventEE event) |
void | onError(AsyncEventEE event) |
void | onStartAsync(AsyncEventEE event) |
void | onTimeout(AsyncEventEE event) |
void | setTimeout(LongSE timeout) Servlet 3 非同期処理では、コンテナー処理スレッドが終了した後にタイムアウト期間が始まります。 |
void | startAsync() 非同期リクエスト処理の開始をマークして、メイン処理スレッドが終了したときに、別のスレッドでさらに処理するためにレスポンスが開いたままになるようにします。 |
checkNotModified, checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getHttpMethod, getLocale, getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isNotModified, isSecure, isUserInRole, toString
getAttribute, getAttributeNames, getRequest, getResponse, getSession, getSessionId, getSessionMutex, isImmutableSessionAttribute, registerDestructionCallback, registerSessionDestructionCallback, removeAttribute, resolveReference, setAttribute, updateAccessedSessionAttributes
isRequestActive, registerRequestDestructionCallback, removeRequestDestructionCallback, requestCompleted
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
getNativeRequest, getNativeRequest, getNativeResponse, getNativeResponse
checkNotModified, checkNotModified, checkNotModified, getContextPath, getDescription, getHeader, getHeaderNames, getHeaderValues, getLocale, getParameter, getParameterMap, getParameterNames, getParameterValues, getRemoteUser, getUserPrincipal, isSecure, isUserInRole
getAttribute, getAttributeNames, getSessionId, getSessionMutex, registerDestructionCallback, removeAttribute, resolveReference, setAttribute
public StandardServletAsyncWebRequest(HttpServletRequestEE request, HttpServletResponseEE response)
request
- 現在の HTTP リクエスト response
- 現在の HTTP レスポンス public void setTimeout(LongSE timeout)
AsyncWebRequest
の setTimeout
timeout
- ミリ秒単位の時間。null
はタイムアウトがないことを意味します。つまり、コンテナーのデフォルトのタイムアウトに依存します。public void addTimeoutHandler(RunnableSE timeoutHandler)
AsyncWebRequest
AsyncWebRequest
の addTimeoutHandler
public void addErrorHandler(ConsumerSE<ThrowableSE> exceptionHandler)
AsyncWebRequest
AsyncWebRequest
の addErrorHandler
public void addCompletionHandler(RunnableSE runnable)
AsyncWebRequest
AsyncWebRequest
の addCompletionHandler
public boolean isAsyncStarted()
AsyncWebRequest
AsyncWebRequest.startAsync()
の呼び出し後、リクエストが非同期モードかどうか。非同期処理が開始されなかった場合、完了した場合、リクエストがさらなる処理のためにディスパッチされた場合、"false" を返します。AsyncWebRequest
の isAsyncStarted
public boolean isAsyncComplete()
非同期処理が完了した後、リクエストオブジェクトとレスポンスオブジェクトの使用を避けることが重要です。サーブレットコンテナーは、しばしば再利用します。
AsyncWebRequest
の isAsyncComplete
public void startAsync()
AsyncWebRequest
AsyncWebRequest
の startAsync
public void dispatch()
AsyncWebRequest
AsyncWebRequest
の dispatch
public void onStartAsync(AsyncEventEE event) throws IOExceptionSE
AsyncListenerEE
の onStartAsyncEE
IOExceptionSE
public void onError(AsyncEventEE event) throws IOExceptionSE
AsyncListenerEE
の onErrorEE
IOExceptionSE
public void onTimeout(AsyncEventEE event) throws IOExceptionSE
AsyncListenerEE
の onTimeoutEE
IOExceptionSE
public void onComplete(AsyncEventEE event) throws IOExceptionSE
AsyncListenerEE
の onCompleteEE
IOExceptionSE