* Valve for this Pipeline (if any).
*/
public Valve getFirst();
+
+ /**
+ * Returns true if all the valves in this pipeline support async, false otherwise
+ * @return true if all the valves in this pipeline support async, false otherwise
+ */
+ public boolean isAsyncSupported();
}
public void event(Request request, Response response, CometEvent event)
throws IOException, ServletException;
+
+ public boolean isAsyncSupported();
+
}
// request parameters
req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
if (postParseRequest(req, request, res, response)) {
+ //check valves if we support async
+ request.setAsyncSupported(connector.getContainer().getPipeline().isAsyncSupported());
// Calling the container
connector.getContainer().getPipeline().getFirst().invoke(request, response);
}
+ @Override
+ public boolean isAsyncSupported() {
+ return pipeline.isAsyncSupported();
+ }
+
+
+
+
}
}
}
}
-
+ if (request.isAsyncSupported()) {
+ request.setAsyncSupported(wrapper.getPipeline().isAsyncSupported());
+ }
wrapper.getPipeline().getFirst().invoke(request, response);
if ((instances !=null ) &&
request.getServerName()));
return;
}
+ if (request.isAsyncSupported()) {
+ request.setAsyncSupported(host.getPipeline().isAsyncSupported());
+ }
// Ask this Host to process this request
host.getPipeline().getFirst().invoke(request, response);
Thread.currentThread().setContextClassLoader
(context.getLoader().getClassLoader());
}
+ if (request.isAsyncSupported()) {
+ request.setAsyncSupported(context.getPipeline().isAsyncSupported());
+ }
+
// Ask this Context to process this request
context.getPipeline().getFirst().invoke(request, response);
* The first valve associated with this Pipeline.
*/
protected Valve first = null;
-
-
+
// --------------------------------------------------------- Public Methods
return (this.info);
}
+
+ public boolean isAsyncSupported() {
+ Valve valve = (first!=null)?first:basic;
+ boolean supported = true;
+ while (supported && valve!=null) {
+ supported = supported & valve.isAsyncSupported();
+ valve = valve.getNext();
+ }
+ return supported;
+ }
// ------------------------------------------------------ Contained Methods
return basic;
}
}
-
-
}
// Reset comet flag value after creating the filter chain
request.setComet(false);
//check filters to see if we support async or not.
- if (filterChain != null) {
+ if (filterChain != null && request.isAsyncSupported()) {
request.setAsyncSupported(filterChain.isAsyncSupported());
}
/**
+ * Does this valve support async reporting
+ */
+ protected boolean asyncSupported = false;
+
+ /**
* The Container whose pipeline this Valve is a component of.
*/
protected Container container = null;
//-------------------------------------------------------------- Properties
-
+
/**
* Return the Container with which this Valve is associated, if any.
*/
}
+ public boolean isAsyncSupported() {
+ return asyncSupported;
+ }
+
+
+ public void setAsyncSupported(boolean asyncSupported) {
+ this.asyncSupported = asyncSupported;
+ }
+
+
/**
* Set the Container with which this Valve is associated, if any.
*
See the License for the specific language governing permissions and
limitations under the License.
-->
-<%@page session="false"%>
+%@page session="false"%>
<pre>
Use cases:
- servlet does a setAsyncTimeout
- servlet does a addAsyncListener
- returns - waits for timeout to happen and listener invoked
+
+5. Dispatch to asyncSupported=false servlet
+ - servlet1 does a startAsync()
+ - servlet1 dispatches to dispatch(/servlet2)
+ - the container calls complete() after servlet2 is complete
+ - TODO
+
+6. Chained dispatch
+ - servlet1 does a startAsync
+ - servlet1 does a dispatch to servlet2 (asyncsupported=true)
+ - servlet2 does a dispatch to servlet3 (asyncsupported=true)
+ - servlet3 does a dispatch to servlet4 (asyncsupported=false)
</pre>
\ No newline at end of file