blob: a832f33d190d6aab2b65fb9a8b3348e9825ea95d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Wed Jun 07 15:10:52 EDT 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Continuation (Jetty :: Project 9.2.22.v20170606 API)</title>
<meta name="date" content="2017-06-07">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Continuation (Jetty :: Project 9.2.22.v20170606 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Continuation.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1149868-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../org/eclipse/jetty/continuation/ContinuationFilter.html" title="class in org.eclipse.jetty.continuation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/jetty/continuation/Continuation.html" target="_top">Frames</a></li>
<li><a href="Continuation.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.jetty.continuation</div>
<h2 title="Interface Continuation" class="title">Interface Continuation</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../org/eclipse/jetty/continuation/ContinuationFilter.FilteredContinuation.html" title="interface in org.eclipse.jetty.continuation">ContinuationFilter.FilteredContinuation</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../org/eclipse/jetty/continuation/Servlet3Continuation.html" title="class in org.eclipse.jetty.continuation">Servlet3Continuation</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">Continuation</span></pre>
<div class="block">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.
<p>
The continuation mechanism is a portable mechanism that will work
asynchronously without additional configuration of all jetty-7,
jetty-8 and Servlet 3.0 containers. With the addition of
the <a href="../../../../org/eclipse/jetty/continuation/ContinuationFilter.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationFilter</code></a>, the mechanism will also work
asynchronously on jetty-6 and non-asynchronously on any
servlet 2.5 container.
<p>
The Continuation API is a simplification of the richer async API
provided by the servlet-3.0 and an enhancement of the continuation
API that was introduced with jetty-6.
</p>
<h1>Continuation Usage</h1>
<p>
A continuation object is obtained for a request by calling the
factory method <a href="../../../../org/eclipse/jetty/continuation/ContinuationSupport.html#getContinuation(javax.servlet.ServletRequest)"><code>ContinuationSupport.getContinuation(ServletRequest)</code></a>.
The continuation type returned will depend on the servlet container
being used.
</p>
<p>
There are two distinct style of operation of the continuation API.
</p>
<h3>Suspend/Resume Usage</h3>
<p>The suspend/resume style is used when a servlet and/or
filter is used to generate the response after a asynchronous wait that is
terminated by an asynchronous handler.
</p>
<pre>
<b>Filter/Servlet:</b>
// if we need to get asynchronous results
Object results = request.getAttribute("results);
if (results==null)
{
Continuation continuation = ContinuationSupport.getContinuation(request);
continuation.suspend();
myAsyncHandler.register(continuation);
return; // or continuation.undispatch();
}
async wait ...
<b>Async Handler:</b>
// when the waited for event happens
continuation.setAttribute("results",event);
continuation.resume();
<b>Filter/Servlet:</b>
// when the request is redispatched
if (results==null)
{
... // see above
}
else
{
response.getOutputStream().write(process(results));
}
</pre>
<h3>Suspend/Complete Usage</h3>
<p>
The suspend/complete style is used when an asynchronous handler is used to
generate the response:
</p>
<pre>
<b>Filter/Servlet:</b>
// when we want to enter asynchronous mode
Continuation continuation = ContinuationSupport.getContinuation(request);
continuation.suspend(response); // response may be wrapped
myAsyncHandler.register(continuation);
return; // or continuation.undispatch();
<b>Wrapping Filter:</b>
// any filter that had wrapped the response should be implemented like:
try
{
chain.doFilter(request,wrappedResponse);
}
finally
{
if (!continuation.isResponseWrapped())
wrappedResponse.finish()
else
continuation.addContinuationListener(myCompleteListener)
}
async wait ...
<b>Async Handler:</b>
// when the async event happens
continuation.getServletResponse().getOutputStream().write(process(event));
continuation.complete()
</pre>
<h1>Continuation Timeout</h1>
<p>
If a continuation is suspended, but neither <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a> or <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a> is
called during the period set by <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#setTimeout(long)"><code>setTimeout(long)</code></a>, then the continuation will
expire and <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isExpired()"><code>isExpired()</code></a> will return true.
</p>
<p>
When a continuation expires, the <a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html#onTimeout(org.eclipse.jetty.continuation.Continuation)"><code>ContinuationListener.onTimeout(Continuation)</code></a>
method is called on any <a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html" title="interface in org.eclipse.jetty.continuation"><code>ContinuationListener</code></a> that has been registered via the
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#addContinuationListener(org.eclipse.jetty.continuation.ContinuationListener)"><code>addContinuationListener(ContinuationListener)</code></a> method. The onTimeout handlers
may write a response and call <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a>. If <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a> is not called,
then the container will redispatch the request as if <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a> had been called,
except that <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isExpired()"><code>isExpired()</code></a> will be true and <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResumed()"><code>isResumed()</code></a> will be false.
</p></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/eclipse/jetty/continuation/ContinuationSupport.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationSupport</code></a>,
<a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html" title="interface in org.eclipse.jetty.continuation"><code>ContinuationListener</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#ATTRIBUTE">ATTRIBUTE</a></strong></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#addContinuationListener(org.eclipse.jetty.continuation.ContinuationListener)">addContinuationListener</a></strong>(<a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html" title="interface in org.eclipse.jetty.continuation">ContinuationListener</a>&nbsp;listener)</code>
<div class="block">Add a ContinuationListener.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()">complete</a></strong>()</code>
<div class="block">Complete a suspended request.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#getAttribute(java.lang.String)">getAttribute</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Get a request attribute.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet">ServletResponse</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#getServletResponse()">getServletResponse</a></strong>()</code>
<div class="block">Get the suspended response.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isExpired()">isExpired</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isInitial()">isInitial</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResponseWrapped()">isResponseWrapped</a></strong>()</code>
<div class="block">Is the suspended response wrapped.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResumed()">isResumed</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isSuspended()">isSuspended</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#removeAttribute(java.lang.String)">removeAttribute</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code>
<div class="block">Remove a request attribute.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()">resume</a></strong>()</code>
<div class="block">Resume a suspended request.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#setAttribute(java.lang.String,%20java.lang.Object)">setAttribute</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name,
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;attribute)</code>
<div class="block">Set a request attribute.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#setTimeout(long)">setTimeout</a></strong>(long&nbsp;timeoutMs)</code>
<div class="block">Set the continuation timeout.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()">suspend</a></strong>()</code>
<div class="block">Suspend the processing of the request and associated
<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet"><code>ServletResponse</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)">suspend</a></strong>(<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet">ServletResponse</a>&nbsp;response)</code>
<div class="block">Suspend the processing of the request and associated
<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet"><code>ServletResponse</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#undispatch()">undispatch</a></strong>()</code>
<div class="block">Undispatch the request.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="ATTRIBUTE">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ATTRIBUTE</h4>
<pre>static final&nbsp;<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> ATTRIBUTE</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.eclipse.jetty.continuation.Continuation.ATTRIBUTE">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="setTimeout(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTimeout</h4>
<pre>void&nbsp;setTimeout(long&nbsp;timeoutMs)</pre>
<div class="block">Set the continuation timeout.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>timeoutMs</code> - The time in milliseconds to wait before expiring this
continuation after a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> or <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a>.
A timeout of <=0 means the continuation will never expire.</dd></dl>
</li>
</ul>
<a name="suspend()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>suspend</h4>
<pre>void&nbsp;suspend()</pre>
<div class="block">Suspend the processing of the request and associated
<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet"><code>ServletResponse</code></a>.
<p>
After this method has been called, the lifecycle of the request will be
extended beyond the return to the container from the
<code>Servlet#service(ServletRequest, ServletResponse)</code> method and
<code>Filter#doFilter(ServletRequest, ServletResponse, FilterChain)</code>
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 <a href="../../../../org/eclipse/jetty/continuation/ContinuationThrowable.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationThrowable</code></a> is thrown).
</p>
<p>
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:
<ul>
<li>a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a>.</li>
<li>a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a>.</li>
<li>the timeout expires.</li>
</ul>
<p>
Typically suspend with no arguments is uses when a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a>
is expected. If a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a> is expected, then the
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a> method should be used instead of this method.
</p></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - If the request cannot be suspended</dd></dl>
</li>
</ul>
<a name="suspend(javax.servlet.ServletResponse)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>suspend</h4>
<pre>void&nbsp;suspend(<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet">ServletResponse</a>&nbsp;response)</pre>
<div class="block">Suspend the processing of the request and associated
<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet"><code>ServletResponse</code></a>.
<p>
After this method has been called, the lifecycle of the request will be
extended beyond the return to the container from the
<code>Servlet#service(ServletRequest, ServletResponse)</code> method and
<code>Filter#doFilter(ServletRequest, ServletResponse, FilterChain)</code>
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 <a href="../../../../org/eclipse/jetty/continuation/ContinuationThrowable.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationThrowable</code></a> is thrown).
</p>
<p>
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:
<ul>
<li>a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a>.</li>
<li>a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a>.</li>
<li>the timeout expires.</li>
</ul>
<p>
Typically suspend with a response argument is uses when a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a>
is expected. If a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a> is expected, then the
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> method should be used instead of this method.
</p>
<p>
Filters that may wrap the response object should check <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResponseWrapped()"><code>isResponseWrapped()</code></a>
to decide if they should destroy/finish the wrapper. If <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResponseWrapped()"><code>isResponseWrapped()</code></a>
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
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a> (potentially using a <a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html#onComplete(org.eclipse.jetty.continuation.Continuation)"><code>ContinuationListener.onComplete(Continuation)</code></a>
listener).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>response</code> - The response to return via a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#getServletResponse()"><code>getServletResponse()</code></a></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - If the request cannot be suspended</dd></dl>
</li>
</ul>
<a name="resume()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resume</h4>
<pre>void&nbsp;resume()</pre>
<div class="block">Resume a suspended request.
<p>
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 <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isInitial()"><code>isInitial()</code></a> false.
</p>
<p>
If resume is called before a suspended request is returned to the
container (ie the thread that called <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> 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 <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isSuspended()"><code>isSuspended()</code></a> and
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResumed()"><code>isResumed()</code></a> return true. Multiple calls to resume are ignored.
</p>
<p>
Typically resume() is used after a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> with
no arguments. The dispatch after a resume call will use the original
request and response objects, even if <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a>
had been passed a wrapped response.
</p></div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the request is not suspended.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a></dd></dl>
</li>
</ul>
<a name="complete()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>complete</h4>
<pre>void&nbsp;complete()</pre>
<div class="block">Complete a suspended request.
<p>
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.
</p>
<p>
If complete is called before a suspended request is returned to the
container (ie the thread that called <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> 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 <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isSuspended()"><code>isSuspended()</code></a> and
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#isResumed()"><code>isResumed()</code></a> return true.
</p>
<p>
Typically resume() is used after a call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a> with
a possibly wrapped response. The async handler should use the response
provided by <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#getServletResponse()"><code>getServletResponse()</code></a> to write the response before
calling <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#complete()"><code>complete()</code></a>. If the request was suspended with a
call to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> then no response object will be available via
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#getServletResponse()"><code>getServletResponse()</code></a>.
</p>
<p>
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.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the request is not suspended.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a></dd></dl>
</li>
</ul>
<a name="isSuspended()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSuspended</h4>
<pre>boolean&nbsp;isSuspended()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>true after <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend()"><code>suspend()</code></a> has been called and before the
request has been redispatched due to being resumed, completed or
timed out.</dd></dl>
</li>
</ul>
<a name="isResumed()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isResumed</h4>
<pre>boolean&nbsp;isResumed()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if the request has been redispatched by a call to
<a href="../../../../org/eclipse/jetty/continuation/Continuation.html#resume()"><code>resume()</code></a>. Returns false after any subsequent call to
suspend</dd></dl>
</li>
</ul>
<a name="isExpired()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isExpired</h4>
<pre>boolean&nbsp;isExpired()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>true after a request has been redispatched as the result of a
timeout. Returns false after any subsequent call to suspend.</dd></dl>
</li>
</ul>
<a name="isInitial()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isInitial</h4>
<pre>boolean&nbsp;isInitial()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>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.</dd></dl>
</li>
</ul>
<a name="isResponseWrapped()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isResponseWrapped</h4>
<pre>boolean&nbsp;isResponseWrapped()</pre>
<div class="block">Is the suspended response wrapped.
<p>
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 <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a>
that passed the wrapped response, then the filter should register
a <a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html" title="interface in org.eclipse.jetty.continuation"><code>ContinuationListener</code></a> to destroy/finish the wrapped response
during a call to <a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html#onComplete(org.eclipse.jetty.continuation.Continuation)"><code>ContinuationListener.onComplete(Continuation)</code></a>.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>True if <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a> has been passed a
<code>ServletResponseWrapper</code> instance.</dd></dl>
</li>
</ul>
<a name="getServletResponse()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServletResponse</h4>
<pre><a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet">ServletResponse</a>&nbsp;getServletResponse()</pre>
<div class="block">Get the suspended response.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the <a href="http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html?is-external=true" title="class or interface in javax.servlet"><code>ServletResponse</code></a> passed to <a href="../../../../org/eclipse/jetty/continuation/Continuation.html#suspend(javax.servlet.ServletResponse)"><code>suspend(ServletResponse)</code></a>.</dd></dl>
</li>
</ul>
<a name="addContinuationListener(org.eclipse.jetty.continuation.ContinuationListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addContinuationListener</h4>
<pre>void&nbsp;addContinuationListener(<a href="../../../../org/eclipse/jetty/continuation/ContinuationListener.html" title="interface in org.eclipse.jetty.continuation">ContinuationListener</a>&nbsp;listener)</pre>
<div class="block">Add a ContinuationListener.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - </dd></dl>
</li>
</ul>
<a name="setAttribute(java.lang.String, java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAttribute</h4>
<pre>void&nbsp;setAttribute(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name,
<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;attribute)</pre>
<div class="block">Set a request attribute.
This method is a convenience method to call the <code>ServletRequest#setAttribute(String, Object)</code>
method on the associated request object.
This is a thread safe call and may be called by any thread.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - the attribute name</dd><dd><code>attribute</code> - the attribute value</dd></dl>
</li>
</ul>
<a name="getAttribute(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAttribute</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;getAttribute(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Get a request attribute.
This method is a convenience method to call the <code>ServletRequest#getAttribute(String)</code>
method on the associated request object.
This is a thread safe call and may be called by any thread.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - the attribute name</dd>
<dt><span class="strong">Returns:</span></dt><dd>the attribute value</dd></dl>
</li>
</ul>
<a name="removeAttribute(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeAttribute</h4>
<pre>void&nbsp;removeAttribute(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre>
<div class="block">Remove a request attribute.
This method is a convenience method to call the <code>ServletRequest#removeAttribute(String)</code>
method on the associated request object.
This is a thread safe call and may be called by any thread.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - the attribute name</dd></dl>
</li>
</ul>
<a name="undispatch()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>undispatch</h4>
<pre>void&nbsp;undispatch()
throws <a href="../../../../org/eclipse/jetty/continuation/ContinuationThrowable.html" title="class in org.eclipse.jetty.continuation">ContinuationThrowable</a></pre>
<div class="block">Undispatch the request.
<p>
This method can be called on a suspended continuation in order
to exit the dispatch to the filter/servlet by throwing a <a href="../../../../org/eclipse/jetty/continuation/ContinuationThrowable.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationThrowable</code></a>
which is caught either by the container or the <a href="../../../../org/eclipse/jetty/continuation/ContinuationFilter.html" title="class in org.eclipse.jetty.continuation"><code>ContinuationFilter</code></a>.
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.
</p>
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.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../org/eclipse/jetty/continuation/ContinuationThrowable.html" title="class in org.eclipse.jetty.continuation">ContinuationThrowable</a></code> - thrown if the request is suspended. The instance of the
exception may be reused on subsequent calls, so the stack frame may not be accurate.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Continuation.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1149868-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../org/eclipse/jetty/continuation/ContinuationFilter.html" title="class in org.eclipse.jetty.continuation"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/jetty/continuation/Continuation.html" target="_top">Frames</a></li>
<li><a href="Continuation.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 1995-2017 <a href="http://webtide.com">Webtide</a>. All Rights Reserved.</small></p>
</body>
</html>