Re: Testing servlet redirects
"Dennis Kempin" <[email protected]>
| Newsgroups | gmane.comp.jakarta.cactus.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Kazuhito, thank you for your answer. My servlet is mapped to process any request that is made. Lets say we have a request on /core/test.html: My servlets checks if it can handle, if not it redirects to the default servlet which should serve test.html (which does exist). But instead of the contents of test.html i get the described 404 Error which says that it cannot find "/core/ServletRedirector". It works fine running the redirect in tomcat and jetty containers without cactus. Regards, Dennis 2006/6/19, Kazuhito SUGURI <[email protected]>: > > Hi Dennis, > > In article <[email protected]>, > Sat, 17 Jun 2006 14:20:15 +0200, > "Dennis Kempin" <[email protected]> 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> > 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. > > Regards, > ---- > Kazuhito SUGURI > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >