Hi,

In article <[EMAIL PROTECTED]>,
Thu, 30 Sep 2004 09:50:43 +0100,
Mamadou Cisse <[EMAIL PROTECTED]> wrote: 
mamadou> I went through the code in the debugger. The thing is that the returned 
mamadou> instance of the RequestDispatcher is NON-NULL, but this instance has an 
mamadou> instance variable called originalDispatcher which is NULL and I believe 
mamadou> this to be the cause of the problem.
mamadou> Before instanciating a test suite, I set the cactus.contextURL to 
mamadou> http://localhost:aport/mycontext using a call to System.setProperty:
mamadou>         System.setProperty("cactus.contextURL", 
mamadou> "http://localhost:aport/mycontext";);
mamadou> So the question is why originalDispatcher in the returned 
mamadou> RequestDispatcher is set to null when a Cactus instanciated 
mamadou> HttpServletRequestWrapper  is passed to a servlet's doPost method, which 
mamadou> in turn calls getRequestDispatcher on the HttpRequestDispatcherWrapper 
mamadou> instance?

Thank you. I believe I understand your problem better.

Following is the getRequestDispatcher method of the AbstractHttpServletRequestWrapper:
    public RequestDispatcher getRequestDispatcher(String thePath)
    {
        if (thePath == null)
        {
            return null;
        }
 
        RequestDispatcher dispatcher = null;
        String fullPath;

        if (thePath.startsWith("/"))
        {
            fullPath = thePath;
        }
        else
        {
            String pI = getPathInfo();
            if (pI == null)
            {
                fullPath = catPath(getServletPath(), thePath);
            }
            else
            {
                fullPath = catPath(getServletPath() + pI, thePath);
            }

            if (fullPath == null)
            {
                return null;
            }
        }

        LOGGER.debug("Computed full path : [" + fullPath + "]");

        dispatcher = new RequestDispatcherWrapper(
            this.request.getRequestDispatcher(fullPath));

        return dispatcher;
    }


Your case can be occured if
    this.request.getRequestDispatcher(fullPath)
returns null because null-check for the originalDispatcher is not taken
in the constructor of the RequestDispatcherWrapper.
Here, this.request should be a HttpServletRequest instance
given from your container.
For fullPath value, please follow the logic of the code above.

Is the fullPath value computed from your command.execute() result,
which is given as the argument thePath, valid for your container?
You can also logging the real fullPath value.

Regards,
----
Kazuhito SUGURI
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to