here is what I posted to the JSR list

This is in relation to
http://markmail.org/message/gafapyibbowo4jdb

There are two problems that we encounter with the test code below
1. This servlet does support Async, so it should call complete(), not rely on the container to do so 2. Since it calls dispatch() before it calls request.setAttribute, it ends up in a loop


   public void dispatchZeroArgTest(ServletRequest request,
            ServletResponse response) throws IOException {

        String where = (String) request.getAttribute("WHERE");
        if ("ASYNC".equals(where)) {
response.getWriter().println("ASYNC_STARTED_dispatchZeroArgTest");
            response.getWriter().println("IsAsyncSupported=" +
                    request.isAsyncSupported());
            response.getWriter().println("IsAsyncStarted=" +
                    request.isAsyncStarted());
        } else {
response.getWriter().println("ASYNC_NOT_STARTED_dispatchZeroArgTest");
            response.getWriter().println("IsAsyncSupported=" +
                    request.isAsyncSupported());
            response.getWriter().println("IsAsyncStarted=" +
                    request.isAsyncStarted());
            AsyncContext ac = request.startAsync();
            ac.dispatch();
            request.setAttribute("WHERE", "ASYNC");
        }
    }



On 03/22/2010 10:49 AM, Filip Hanik - Dev Lists wrote:
my implementation makes an assumption that the app calls complete(), but it seems as the TCK expects the container to call complete for the app. This is specifically in the dispatchZeroArgTest. The spec defines is as the container will call complete() if the servlet doesn't support async. However, in the dispatchZeroArgTest, it dispatches to itself, a servlet that does support async, so I'm not sure our stuff is wrong here.

<servlet>
<servlet-name>AsyncTestServlet</servlet-name>
<servlet-class>com.sun.ts.tests.servlet.api.javax_servlet.asyncevent.AsyncTestServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>



  public void complete() - If request.startAsync is called then this
  method MUST be called to complete the async processing and commit and
close the response. The complete method can be invoked by the container if the request is dispatched to a servlet that does not support async processing, or
  the target servlet called by AsyncContext.dispatch does not do a
subsequent call to startAsync. In this case, it is the container's responsibility to call complete() as soon as that servlet's service method is exited. An
  IllegalStateException MUST be thrown if startAsync was not called. It
  is legal to call this method anytime after a call to
  ServletRequest.startAsync() or
  ServletRequest.startAsync(ServletRequest, ServletResponse)
and before a call to one of the dispatch methods. If this method is called before the container-initiated dispatch that called startAsync has returned to the container, then the call will not take effect until after the container-initiated
  dispatch has returned to the container. Invocation of the
  AsyncListener.onComplete(AsyncEvent) will also be delayed till after
  the container-initiated dispatch has returned to the container.



On 03/20/2010 07:30 AM, Mark Thomas wrote:
On 19/03/2010 14:22, fha...@apache.org wrote:
Author: fhanik
Date: Fri Mar 19 14:22:09 2010
New Revision: 925232

URL: http://svn.apache.org/viewvc?rev=925232&view=rev
Log:
More async stuff, only timeout left
I tried running the Servlet 3.0 TCK just to see how much would pass but
didn't get very far.

As far as I can tell, AsyncContext.complete() is never called so
requests get stuck in the AsyncState.DISPATCHED state. I'm still trying
to get my head around the async part of the spec and how the async
implementation works so I'm not at all sure where the call(s) to
complete() need to be added or if indeed this is the problem.

I want to understand how the Async impl works so I'll keep looking at
this but don't let that stop you fixing it if you get a chance.

Cheers,

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to