jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuhito SUGURI <suguri.kazuh...@lab.ntt.co.jp>
Subject Re: Testing servlet redirects
Date Mon, 19 Jun 2006 12:43:58 GMT
Hi Dennis,

In article <eb76c8de0606170520y121126f5tecb90b6a6c5162be@mail.gmail.com>,
Sat, 17 Jun 2006 14:20:15 +0200,
"Dennis Kempin" <dennis.kempin@googlemail.com> wrote: 
dennis> i am using the JettyTestSetup to test a simple Servlet. This servlet
dennis> sometimes calls
dennis> getServletContext().getNamedDispatcher("default").forward(request,
dennis> response); to redirect requests to the default servlet to serve static
dennis> resources.
dennis> Well this is what Jetty returns as response when such a redirect happens:
dennis> HTTP ERROR: 404 /core/ServletRedirector Not Found
dennis> RequestURI=/core/ServletRedirector
dennis> Where core is the context path.

Do you mean that the 404 response is the expected behavior of
RequestDispatcher#foward() performed by your servlet?

dennis> It is not important for me to test what the redirect returns, its more
dennis> important that the servlet performs the redirect. That is what I want to
dennis> test.
dennis> Any ideas on how to test that (Testing for this error message would be a
dennis> very hacky solution)?

I don't think the error message is the expected result, however,
I think you need to evaluate the response at endXXX(WebResponse) method
to test RequestDispatcher#forward works as expected.

Kazuhito SUGURI

View raw message