Class FauxContinuation
- java.lang.Object
-
- org.eclipse.jetty.continuation.FauxContinuation
-
- All Implemented Interfaces:
Continuation,ContinuationFilter.FilteredContinuation
@Deprecated class FauxContinuation extends java.lang.Object implements ContinuationFilter.FilteredContinuation
Deprecated.use Servlet 3.0AsyncContextinsteadA blocking implementation of Continuation. This implementation of Continuation is used by theContinuationFilterwhen there are is no native or asynchronous continuation type available.
-
-
Field Summary
Fields Modifier and Type Field Description private static int__COMPLETEDeprecated.private static int__COMPLETINGDeprecated.private static ContinuationThrowable__exceptionDeprecated.private static int__HANDLINGDeprecated.private static int__RESUMINGDeprecated.private static int__SUSPENDEDDeprecated.private static int__SUSPENDINGDeprecated.private static int__UNSUSPENDINGDeprecated.private boolean_initialDeprecated.private java.util.ArrayList<ContinuationListener>_listenersDeprecated.private javax.servlet.ServletRequest_requestDeprecated.private javax.servlet.ServletResponse_responseDeprecated.private boolean_responseWrappedDeprecated.private boolean_resumedDeprecated.private int_stateDeprecated.private boolean_timeoutDeprecated.private long_timeoutMsDeprecated.-
Fields inherited from interface org.eclipse.jetty.continuation.Continuation
ATTRIBUTE
-
-
Constructor Summary
Constructors Constructor Description FauxContinuation(javax.servlet.ServletRequest request)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddContinuationListener(ContinuationListener listener)Deprecated.Add a ContinuationListener.voidcomplete()Deprecated.Complete a suspended request.booleanenter(javax.servlet.ServletResponse response)Deprecated.booleanexit()Deprecated.protected voidexpire()Deprecated.private voidfauxResume()Deprecated.private voidfauxSuspend()Deprecated.java.lang.ObjectgetAttribute(java.lang.String name)Deprecated.Get a request attribute.javax.servlet.ServletResponsegetServletResponse()Deprecated.Get the suspended response.(package private) java.lang.StringgetStatusString()Deprecated.(package private) voidhandling()Deprecated.booleanisExpired()Deprecated.booleanisInitial()Deprecated.booleanisResponseWrapped()Deprecated.Is the suspended response wrapped.booleanisResumed()Deprecated.booleanisSuspended()Deprecated.voidonComplete()Deprecated.voidonTimeout()Deprecated.voidremoveAttribute(java.lang.String name)Deprecated.Remove a request attribute.voidresume()Deprecated.Resume a suspended request.voidsetAttribute(java.lang.String name, java.lang.Object attribute)Deprecated.Set a request attribute.voidsetTimeout(long timeoutMs)Deprecated.Set the continuation timeout.voidsuspend()Deprecated.Suspend the processing of the request and associatedServletResponse.voidsuspend(javax.servlet.ServletResponse response)Deprecated.Suspend the processing of the request and associatedServletResponse.java.lang.StringtoString()Deprecated.voidundispatch()Deprecated.Undispatch the request.
-
-
-
Field Detail
-
__exception
private static final ContinuationThrowable __exception
Deprecated.
-
__HANDLING
private static final int __HANDLING
Deprecated.- See Also:
- Constant Field Values
-
__SUSPENDING
private static final int __SUSPENDING
Deprecated.- See Also:
- Constant Field Values
-
__RESUMING
private static final int __RESUMING
Deprecated.- See Also:
- Constant Field Values
-
__COMPLETING
private static final int __COMPLETING
Deprecated.- See Also:
- Constant Field Values
-
__SUSPENDED
private static final int __SUSPENDED
Deprecated.- See Also:
- Constant Field Values
-
__UNSUSPENDING
private static final int __UNSUSPENDING
Deprecated.- See Also:
- Constant Field Values
-
__COMPLETE
private static final int __COMPLETE
Deprecated.- See Also:
- Constant Field Values
-
_request
private final javax.servlet.ServletRequest _request
Deprecated.
-
_response
private javax.servlet.ServletResponse _response
Deprecated.
-
_state
private int _state
Deprecated.
-
_initial
private boolean _initial
Deprecated.
-
_resumed
private boolean _resumed
Deprecated.
-
_timeout
private boolean _timeout
Deprecated.
-
_responseWrapped
private boolean _responseWrapped
Deprecated.
-
_timeoutMs
private long _timeoutMs
Deprecated.
-
_listeners
private java.util.ArrayList<ContinuationListener> _listeners
Deprecated.
-
-
Method Detail
-
onComplete
public void onComplete()
Deprecated.
-
onTimeout
public void onTimeout()
Deprecated.
-
isResponseWrapped
public boolean isResponseWrapped()
Deprecated.Description copied from interface:ContinuationIs the suspended response wrapped.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 aContinuationListenerto destroy/finish the wrapped response during a call toContinuationListener.onComplete(Continuation).- Specified by:
isResponseWrappedin interfaceContinuation- Returns:
- True if
Continuation.suspend(ServletResponse)has been passed aServletResponseWrapperinstance. - See Also:
Continuation.isResponseWrapped()
-
isInitial
public boolean isInitial()
Deprecated.- Specified by:
isInitialin interfaceContinuation- Returns:
- true while the request is within the initial dispatch to the filter chain and/or servlet. Will return false once the calling thread has returned to the container after suspend has been called and during any subsequent redispatch.
-
isResumed
public boolean isResumed()
Deprecated.- Specified by:
isResumedin interfaceContinuation- Returns:
- true if the request has been redispatched by a call to
Continuation.resume(). Returns false after any subsequent call to suspend
-
isSuspended
public boolean isSuspended()
Deprecated.- Specified by:
isSuspendedin interfaceContinuation- Returns:
- true after
Continuation.suspend()has been called and before the request has been redispatched due to being resumed, completed or timed out.
-
isExpired
public boolean isExpired()
Deprecated.- Specified by:
isExpiredin interfaceContinuation- Returns:
- true after a request has been redispatched as the result of a timeout. Returns false after any subsequent call to suspend.
-
setTimeout
public void setTimeout(long timeoutMs)
Deprecated.Description copied from interface:ContinuationSet the continuation timeout.- Specified by:
setTimeoutin interfaceContinuation- Parameters:
timeoutMs- The time in milliseconds to wait before expiring this continuation after a call toContinuation.suspend()orContinuation.suspend(ServletResponse). A timeout of <=0 means the continuation will never expire.
-
suspend
public void suspend(javax.servlet.ServletResponse response)
Deprecated.Description copied from interface:ContinuationSuspend the processing of the request and associatedServletResponse.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 andFilter.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 thanContinuationThrowableis 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:
- a call to
Continuation.resume(). - a call to
Continuation.complete(). - the timeout expires.
Typically suspend with a response argument is uses when a call to
Continuation.complete()is expected. If a call toContinuation.resume()is expected, then theContinuation.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. IfContinuation.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 toContinuation.complete()(potentially using aContinuationListener.onComplete(Continuation)listener).- Specified by:
suspendin interfaceContinuation- Parameters:
response- The response to return via a call toContinuation.getServletResponse()
- a call to
-
suspend
public void suspend()
Deprecated.Description copied from interface:ContinuationSuspend the processing of the request and associatedServletResponse.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 andFilter.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 thanContinuationThrowableis 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:
- a call to
Continuation.resume(). - a call to
Continuation.complete(). - the timeout expires.
Typically suspend with no arguments is uses when a call to
Continuation.resume()is expected. If a call toContinuation.complete()is expected, then theContinuation.suspend(ServletResponse)method should be used instead of this method.- Specified by:
suspendin interfaceContinuation
- a call to
-
resume
public void resume()
Deprecated.Description copied from interface:ContinuationResume a suspended request.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 bothContinuation.isSuspended()andContinuation.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 ifContinuation.suspend(ServletResponse)had been passed a wrapped response.- Specified by:
resumein interfaceContinuation- See Also:
Continuation.suspend()
-
complete
public void complete()
Deprecated.Description copied from interface:ContinuationComplete a suspended request.This 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 bothContinuation.isSuspended()andContinuation.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 byContinuation.getServletResponse()to write the response before callingContinuation.complete(). If the request was suspended with a call toContinuation.suspend()then no response object will be available viaContinuation.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.
- Specified by:
completein interfaceContinuation- See Also:
Continuation.suspend()
-
enter
public boolean enter(javax.servlet.ServletResponse response)
Deprecated.- Specified by:
enterin interfaceContinuationFilter.FilteredContinuation- See Also:
Continuation.getServletResponse()
-
getServletResponse
public javax.servlet.ServletResponse getServletResponse()
Deprecated.Description copied from interface:ContinuationGet the suspended response.- Specified by:
getServletResponsein interfaceContinuation- Returns:
- the
ServletResponsepassed toContinuation.suspend(ServletResponse). - See Also:
Continuation.getServletResponse()
-
handling
void handling()
Deprecated.
-
exit
public boolean exit()
Deprecated.- Specified by:
exitin interfaceContinuationFilter.FilteredContinuation- Returns:
- true if handling is complete
-
expire
protected void expire()
Deprecated.
-
fauxSuspend
private void fauxSuspend()
Deprecated.
-
fauxResume
private void fauxResume()
Deprecated.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
getStatusString
java.lang.String getStatusString()
Deprecated.
-
addContinuationListener
public void addContinuationListener(ContinuationListener listener)
Deprecated.Description copied from interface:ContinuationAdd a ContinuationListener.- Specified by:
addContinuationListenerin interfaceContinuation- Parameters:
listener- the listener
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Deprecated.Description copied from interface:ContinuationGet a request attribute. This method is a convenience method to call theServletRequest.getAttribute(String)method on the associated request object. This is a thread safe call and may be called by any thread.- Specified by:
getAttributein interfaceContinuation- Parameters:
name- the attribute name- Returns:
- the attribute value
- See Also:
Continuation.getAttribute(java.lang.String)
-
removeAttribute
public void removeAttribute(java.lang.String name)
Deprecated.Description copied from interface:ContinuationRemove a request attribute. This method is a convenience method to call theServletRequest.removeAttribute(String)method on the associated request object. This is a thread safe call and may be called by any thread.- Specified by:
removeAttributein interfaceContinuation- Parameters:
name- the attribute name- See Also:
Continuation.removeAttribute(java.lang.String)
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object attribute)Deprecated.Description copied from interface:ContinuationSet a request attribute. This method is a convenience method to call theServletRequest.setAttribute(String, Object)method on the associated request object. This is a thread safe call and may be called by any thread.- Specified by:
setAttributein interfaceContinuation- Parameters:
name- the attribute nameattribute- the attribute value- See Also:
Continuation.setAttribute(java.lang.String, java.lang.Object)
-
undispatch
public void undispatch()
Deprecated.Description copied from interface:ContinuationUndispatch the request.This method can be called on a suspended continuation in order to exit the dispatch to the filter/servlet by throwing a
This method should only be used as a last resort and a normal return is a prefereable solution if filters can be updated to handle that case.ContinuationThrowablewhich is caught either by the container or theContinuationFilter. 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.- Specified by:
undispatchin interfaceContinuation- See Also:
Continuation.undispatch()
-
-