Hi Mark, thanks for the reply.

I've modified https://github.com/paul-hammant/servletDispatcherTest to
include scripts to reproduce the problem, and to show the two web-apps
working separately, but not in the getRequestDispatcher(..).include(..) way.

The scripts download an anointed version of Tomcat7, add
the crossContext="true" attr to context.xml, and even copy the war files
into the webapps/ folder.

In the README.md, which Github kindly renders into HTML on the front page
of the project, there's instructions to build/deploy, as well as what URLs
to click on to see the problem, as I see it.

There are now three servlet-filters activated for different urls:

  /a/IOutputMyThreadID  (class of same name)
  /a/AIncludingContentFromB  (class of same name, extends IOutputMyThreadID)
  /b/IAlsoOutputMyThreadID  (class of same name)

- Paul


On Mon, Jul 1, 2013 at 2:34 PM, Mark Thomas <ma...@apache.org> wrote:

> 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