users@glassfish.java.net

Re: servlet 3.0 async, gfv3

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 14 Apr 2010 12:30:58 -0700

Hi Gary,

emiddio-verizon wrote:
> thanks for the servlet; i will study and use it.
>
> my servlet's init() is being called for each browser request -- i
> guess i will file a bug; also seen with
> gfv3 sample async-request-war when debug stepping thru the code.

There is a bug in AjaxCometServlet#init: It is not calling
super.init(config), thus violating the contract of
javax.servlet.GenericServlet#init, which reads:

     * When overriding this form of the method, call
     * <code>super.init(config)</code>.

So this is a problem specific to AjaxCometServlet, but not a problem
that would apply to all Servlets that are declared to support async
operations.

Thanks for catching this!

Please go ahead and file a bug against samples.

>
> your why not question --
>
> servlet1 dispatches with
> AsyncContext ac = request.startAsync();
> ...
> ac.dispatch("servlet2");
>
> servlet2 tries to get AsyncContext via
> request.getAsyncContext(); -- get exception because
> request.isAsyncStarted() is false;
>
> if unable to get the AsyncContext cannot call ac.complete();

We'll look into this.

Thanks,

Jan

>
> gary
>
>
> Yes, only one init per Servlet, regardless of whether the Servlet
> is declared to support async operations. Shing Wai has confirmed
> in an earlier email that this is the case.
>>
>>
>> i have not figured how i am suppose to use
>> AsycnContext.complete(); if i async.dispach to another servlet --
>> that servlet cannot
>> call AsyncContext.complete();
>
> Why not?
>
>