On 29/06/2013 13:51, Paul Hammant wrote:
> If you edit conf/context.xml and add crossContext="true", one Tomcat
> mounted web-app should be able to forward to (or include content from)
> another in the same request.
> 
> I can't get it working and I have a minimal Github project (
> https://github.com/paul-hammant/servletDispatcherTest) that shows how far I
> got. It has 'a' and 'b' as web-apps (war files) and simple five line
> servlets showing the code, attempting to use
> 
>         // in 'a' webapp servlet filter ...
>         ServletContext context =
> httpsr.getSession().getServletContext().getContext("/b");
>         RequestDispatcher requestDispatcher =
> context.getRequestDispatcher("/anything");
>         requestDispatcher.include(request, response);
>         // gives .. The requested resource (/b/anything) is not available
> // If it were not for crossContext="true", there would be a n NPE.

The test only uses filters. My suspicion (since you haven't provided any
Tomcat config details) is that the mapper is failing to map the request
to a Servlet and that triggers the not available error.

> I'm looking for a whole example of this working. I mean a downloadable and
> buildable zip of a project somewhere on the web. Obviously I've tried
> google searching for that. I've also looked in Tomcat's source and can't
> see and example or integration test for crossContext :-(

It is tested by the Servlet 3 TCK (which every release of Tomcat 7 has
passed).

Mark


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

Reply via email to