简体   繁体   English

码头7延续:如何*不*重新发送请求?

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

I'm using Jetty 7 continuations to implement some asynchronous processing. 我正在使用Jetty 7延续来实现一些异步处理。 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. 我正在尝试做的是从延续开始(通过.suspend()),然后将延续交给其他组成响应的对象,效果很好。 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. 但是Jetty会继续将响应(使用isInitial = false)重新分发给servlet,我不希望也不需要这样做,因为响应是由其他对象处理的。

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 : 请参阅http://wiki.eclipse.org/Jetty/Feature/Continuations中有关continuation.isInitial()的文档:

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. 当继续执行继续操作时,该请求将重新发送到servlet容器,几乎就像再次接收到该请求一样。 However during the redispatch, the continuation.isInitial() method returns false and any attributes set by the asynchronous handler are available. 但是,在重新分配过程中, continuation.isInitial()方法返回false,并且异步处理程序设置的任何属性均可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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