AsyncContext instead@Deprecated class FauxContinuation extends java.lang.Object implements ContinuationFilter.FilteredContinuation
ContinuationFilter
when there are is no native or asynchronous continuation type available.| Modifier and Type | Field and Description |
|---|---|
private static int |
__COMPLETE
Deprecated.
|
private static int |
__COMPLETING
Deprecated.
|
private static ContinuationThrowable |
__exception
Deprecated.
|
private static int |
__HANDLING
Deprecated.
|
private static int |
__RESUMING
Deprecated.
|
private static int |
__SUSPENDED
Deprecated.
|
private static int |
__SUSPENDING
Deprecated.
|
private static int |
__UNSUSPENDING
Deprecated.
|
private boolean |
_initial
Deprecated.
|
private java.util.ArrayList<ContinuationListener> |
_listeners
Deprecated.
|
private javax.servlet.ServletRequest |
_request
Deprecated.
|
private javax.servlet.ServletResponse |
_response
Deprecated.
|
private boolean |
_responseWrapped
Deprecated.
|
private boolean |
_resumed
Deprecated.
|
private int |
_state
Deprecated.
|
private boolean |
_timeout
Deprecated.
|
private long |
_timeoutMs
Deprecated.
|
ATTRIBUTE| Constructor and Description |
|---|
FauxContinuation(javax.servlet.ServletRequest request)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContinuationListener(ContinuationListener listener)
Deprecated.
Add a ContinuationListener.
|
void |
complete()
Deprecated.
Complete a suspended request.
|
boolean |
enter(javax.servlet.ServletResponse response)
Deprecated.
|
boolean |
exit()
Deprecated.
|
protected void |
expire()
Deprecated.
|
private void |
fauxResume()
Deprecated.
|
private void |
fauxSuspend()
Deprecated.
|
java.lang.Object |
getAttribute(java.lang.String name)
Deprecated.
Get a request attribute.
|
javax.servlet.ServletResponse |
getServletResponse()
Deprecated.
Get the suspended response.
|
(package private) java.lang.String |
getStatusString()
Deprecated.
|
(package private) void |
handling()
Deprecated.
|
boolean |
isExpired()
Deprecated.
|
boolean |
isInitial()
Deprecated.
|
boolean |
isResponseWrapped()
Deprecated.
Is the suspended response wrapped.
|
boolean |
isResumed()
Deprecated.
|
boolean |
isSuspended()
Deprecated.
|
void |
onComplete()
Deprecated.
|
void |
onTimeout()
Deprecated.
|
void |
removeAttribute(java.lang.String name)
Deprecated.
Remove a request attribute.
|
void |
resume()
Deprecated.
Resume a suspended request.
|
void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Deprecated.
Set a request attribute.
|
void |
setTimeout(long timeoutMs)
Deprecated.
Set the continuation timeout.
|
void |
suspend()
Deprecated.
Suspend the processing of the request and associated
ServletResponse. |
void |
suspend(javax.servlet.ServletResponse response)
Deprecated.
Suspend the processing of the request and associated
ServletResponse. |
java.lang.String |
toString()
Deprecated.
|
void |
undispatch()
Deprecated.
Undispatch the request.
|
private static final ContinuationThrowable __exception
private static final int __HANDLING
private static final int __SUSPENDING
private static final int __RESUMING
private static final int __COMPLETING
private static final int __SUSPENDED
private static final int __UNSUSPENDING
private static final int __COMPLETE
private final javax.servlet.ServletRequest _request
private javax.servlet.ServletResponse _response
private int _state
private boolean _initial
private boolean _resumed
private boolean _timeout
private boolean _responseWrapped
private long _timeoutMs
private java.util.ArrayList<ContinuationListener> _listeners
FauxContinuation(javax.servlet.ServletRequest request)
public void onComplete()
public void onTimeout()
public boolean isResponseWrapped()
Continuation
Filters that wrap the response object should check this method to
determine if they should destroy/finish the wrapped response. If
the request was suspended with a call to Continuation.suspend(ServletResponse)
that passed the wrapped response, then the filter should register
a ContinuationListener to destroy/finish the wrapped response
during a call to ContinuationListener.onComplete(Continuation).
isResponseWrapped in interface ContinuationContinuation.suspend(ServletResponse) has been passed a
ServletResponseWrapper instance.Continuation.isResponseWrapped()public boolean isInitial()
isInitial in interface Continuationpublic boolean isResumed()
isResumed in interface ContinuationContinuation.resume(). Returns false after any subsequent call to
suspendpublic boolean isSuspended()
isSuspended in interface ContinuationContinuation.suspend() has been called and before the
request has been redispatched due to being resumed, completed or
timed out.public boolean isExpired()
isExpired in interface Continuationpublic void setTimeout(long timeoutMs)
ContinuationsetTimeout in interface ContinuationtimeoutMs - The time in milliseconds to wait before expiring this
continuation after a call to Continuation.suspend() or Continuation.suspend(ServletResponse).
A timeout of <=0 means the continuation will never expire.public void suspend(javax.servlet.ServletResponse response)
ContinuationServletResponse.
After this method has been called, the lifecycle of the request will be
extended beyond the return to the container from the
Servlet.service(ServletRequest, ServletResponse) method and
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
calls. When a suspended request is returned to the container after
a dispatch, then the container will not commit the associated response
(unless an exception other than ContinuationThrowable is thrown).
When the thread calling the filter chain and/or servlet has returned to the container with a suspended request, the thread is freed for other tasks and the request is held until either:
Continuation.resume().Continuation.complete().
Typically suspend with a response argument is uses when a call to Continuation.complete()
is expected. If a call to Continuation.resume() is expected, then the
Continuation.suspend() method should be used instead of this method.
Filters that may wrap the response object should check Continuation.isResponseWrapped()
to decide if they should destroy/finish the wrapper. If Continuation.isResponseWrapped()
returns true, then the wrapped request has been passed to the asynchronous
handler and the wrapper should not be destroyed/finished until after a call to
Continuation.complete() (potentially using a ContinuationListener.onComplete(Continuation)
listener).
suspend in interface Continuationresponse - The response to return via a call to Continuation.getServletResponse()public void suspend()
ContinuationServletResponse.
After this method has been called, the lifecycle of the request will be
extended beyond the return to the container from the
Servlet.service(ServletRequest, ServletResponse) method and
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
calls. When a suspended request is returned to the container after
a dispatch, then the container will not commit the associated response
(unless an exception other than ContinuationThrowable is thrown).
When the thread calling the filter chain and/or servlet has returned to the container with a suspended request, the thread is freed for other tasks and the request is held until either:
Continuation.resume().Continuation.complete().
Typically suspend with no arguments is uses when a call to Continuation.resume()
is expected. If a call to Continuation.complete() is expected, then the
Continuation.suspend(ServletResponse) method should be used instead of this method.
suspend in interface Continuationpublic void resume()
Continuation
This method can be called by any thread that has been passed a reference
to a continuation. When called the request is redispatched to the
normal filter chain and servlet processing with Continuation.isInitial() false.
If resume is called before a suspended request is returned to the
container (ie the thread that called Continuation.suspend() is still
within the filter chain and/or servlet service method), then the resume
does not take effect until the call to the filter chain and/or servlet
returns to the container. In this case both Continuation.isSuspended() and
Continuation.isResumed() return true. Multiple calls to resume are ignored.
Typically resume() is used after a call to Continuation.suspend() with
no arguments. The dispatch after a resume call will use the original
request and response objects, even if Continuation.suspend(ServletResponse)
had been passed a wrapped response.
resume in interface ContinuationContinuation.suspend()public void complete()
ContinuationThis method can be called by any thread that has been passed a reference to a suspended request. When a request is completed, the associated response object committed and flushed. The request is not redispatched.
If complete is called before a suspended request is returned to the
container (ie the thread that called Continuation.suspend() is still
within the filter chain and/or servlet service method), then the complete
does not take effect until the call to the filter chain and/or servlet
returns to the container. In this case both Continuation.isSuspended() and
Continuation.isResumed() return true.
Typically resume() is used after a call to Continuation.suspend(ServletResponse) with
a possibly wrapped response. The async handler should use the response
provided by Continuation.getServletResponse() to write the response before
calling Continuation.complete(). If the request was suspended with a
call to Continuation.suspend() then no response object will be available via
Continuation.getServletResponse().
Once complete has been called and any thread calling the filter chain and/or servlet chain has returned to the container, the request lifecycle is complete. The container is able to recycle request objects, so it is not valid hold a request or continuation reference after the end of the life cycle.
complete in interface ContinuationContinuation.suspend()public boolean enter(javax.servlet.ServletResponse response)
enter in interface ContinuationFilter.FilteredContinuationContinuation.getServletResponse()public javax.servlet.ServletResponse getServletResponse()
ContinuationgetServletResponse in interface ContinuationServletResponse passed to Continuation.suspend(ServletResponse).Continuation.getServletResponse()void handling()
public boolean exit()
exit in interface ContinuationFilter.FilteredContinuationprotected void expire()
private void fauxSuspend()
private void fauxResume()
public java.lang.String toString()
toString in class java.lang.Objectjava.lang.String getStatusString()
public void addContinuationListener(ContinuationListener listener)
ContinuationaddContinuationListener in interface Continuationlistener - the listenerpublic java.lang.Object getAttribute(java.lang.String name)
ContinuationServletRequest.getAttribute(String)
method on the associated request object.
This is a thread safe call and may be called by any thread.getAttribute in interface Continuationname - the attribute nameContinuation.getAttribute(java.lang.String)public void removeAttribute(java.lang.String name)
ContinuationServletRequest.removeAttribute(String)
method on the associated request object.
This is a thread safe call and may be called by any thread.removeAttribute in interface Continuationname - the attribute nameContinuation.removeAttribute(java.lang.String)public void setAttribute(java.lang.String name,
java.lang.Object attribute)
ContinuationServletRequest.setAttribute(String, Object)
method on the associated request object.
This is a thread safe call and may be called by any thread.setAttribute in interface Continuationname - the attribute nameattribute - the attribute valueContinuation.setAttribute(java.lang.String, java.lang.Object)public void undispatch()
Continuation
This method can be called on a suspended continuation in order
to exit the dispatch to the filter/servlet by throwing a ContinuationThrowable
which is caught either by the container or the ContinuationFilter.
This is an alternative to simply returning from the dispatch in the case
where filters in the filter chain may not be prepared to handle a suspended
request.
undispatch in interface ContinuationContinuation.undispatch()