|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Continuation
Continuation. A continuation is a mechanism by which a HTTP Request can be suspended and restarted after a timeout or an asynchronous event has occurred.
| Field Summary | |
|---|---|
static String |
ATTRIBUTE
|
| Method Summary | |
|---|---|
void |
addContinuationListener(ContinuationListener listener)
|
void |
complete()
Complete a suspended request. |
boolean |
isExpired()
|
boolean |
isInitial()
|
boolean |
isResumed()
|
boolean |
isSuspended()
|
void |
keepWrappers()
Call to signal that the suspending filter/servlet has kept a reference to any passed requests wrappers, and that these should not be finalized until a onComplete event has been seen. |
void |
resume()
Resume a suspended request. |
void |
setTimeout(long timeoutMs)
Set the continuation timeout |
void |
suspend()
Suspend the processing of the request and associated ServletResponse. |
boolean |
wrappersKept()
|
| Field Detail |
|---|
static final String ATTRIBUTE
| Method Detail |
|---|
void setTimeout(long timeoutMs)
timeoutMs - The time in milliseconds to wait before expiring this
continuation.void suspend()
ServletResponse.
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. If a request is suspended, then the container will not commit the
associated response when the call to the filter chain and/or servlet
service method returns to the container. Any exceptions thrown to the
container by a filter chain and/or servlet for a suspended requests are
silently ignored.
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 pending either:
ServletRequest#resume().ServletRequest#complete().After any of the events listed above, the suspended request will be redispatched via the filter and servlet processing.
Suspend may only be called by a thread that is within the service calling
stack of
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
and/or Servlet.service(ServletRequest, ServletResponse). A
request that has been dispatched for error handling may not be suspended.
IllegalStateException - If the calling thread is not within the calling stack of
Filter.doFilter(ServletRequest, ServletResponse, FilterChain)
and/or
Servlet.service(ServletRequest, ServletResponse)
or if the request has been dispatched for error handling.#resume()},
#complete()}void resume()
This method can be called by any thread that has been passed a reference to a suspended request. When called the request is redispatched to the normal filter chain and servlet processing.
If resume is called before a suspended request is returned to the
container (ie the thread that called #suspend(long) 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 isSuspended() and
isResumed() return true.
Multiple calls to resume are ignored
IllegalStateException - if the request is not suspended.#suspend()}void complete()
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 commited 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 #suspend(long) 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 isSuspended() and
isResumed() return true.
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 reference after the end of the life cycle or to call any request methods.
IllegalStateException - if the request is not suspended.#suspend()}boolean isSuspended()
#suspend(long) has been called and before the
request has been redispatched due to being resumed, completed or
timed out.boolean isResumed()
resume(). Returns false after any subsequent call to
suspendboolean isExpired()
boolean isInitial()
void keepWrappers()
boolean wrappersKept()
keepWrappers() has been called.void addContinuationListener(ContinuationListener listener)
listener -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||