简体   繁体   中英

Jetty 7 Continuations: How to *not* redispatch the request?

I'm using Jetty 7 continuations to implement some asynchronous processing. What I'm trying to do is start off the continuation (via .suspend()), and then hand the continuation off to some other object that will compose the response, which works fine. But Jetty keeps redispatching the response (with isInitial = false) to the servlet, and I don't want or need that, because the response is being dealt with by some other object.

So, I'd like to find a way to explicitly not redispatch the request on timeout or expire, because I'm using an event-driven series of callbacks to actually produce the response.

See the documentation around continuation.isInitial() - from http://wiki.eclipse.org/Jetty/Feature/Continuations :

Resuming a Request

Once an asynchronous event has occurred, the continuation can be resumed:

 void myAsyncCallback(Object results) { continuation.setAttribute("results",results); continuation.resume(); } 

When a continuation is resumed, the request is redispatched to the servlet container, almost as if the request had been received again. However during the redispatch, the continuation.isInitial() method returns false and any attributes set by the asynchronous handler are available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM