Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Continuation.suspend(4000) migrating to Jetty9

Thats cool. Thanks a lot.
In Jetty6 there are methods to get and set objects 
continuation.setObject(<someobj>), continuation.getObject(). 
May i know how can i achieve the same using AsyncContext?


On Tue, Oct 15, 2013 at 5:02 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Hi,

On Tue, Oct 15, 2013 at 10:39 AM, baskar_ram <baskar.nitt@xxxxxxxxx> wrote:
> Code written in jetty6
> if (continuation.suspend(4000)) //Here continuation is an object of
> Continuation Type
> {
>    //Some business logic
> }
>
> Hi i want to migrate the above code to Jetty9, but in Jetty9 suspend()
> method doesn't accept parameters and its return type is void.
> Please let me know the equivalent code for the above code.

Don't use the continuations anymore, since Jetty 9 is a Servlet 3
compliant servlet container.
Use:

HttpServletRequest request = ...;

AsyncContext context = request.startAsync();
context.setTimeout(4000);
// Some business logic

You should be able to use AsyncContext like you were using Continuation.
Continuation.resume() --> AsyncContext.dispatch()

Note that AsyncContext is much more powerful, because it also allows
for completing the response without resuming, via
AsyncContext.complete(), which is more efficient.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top