I have a scenario where I have single entry point Servlet and further Servlets that requests are forwarded to that undertake heavy processing.
I am looking at options to
You could distribute it over webapps in a clustered Tomcat environment and add crossContext="true"
to the <Context>
element of the webapps in question. Here's an extract of Tomcat's Context Configuration Reference:
crossContext
Set to
true
if you want calls within this application toServletContext.getContext()
to successfully return a request dispatcher for other web applications running on this virtual host. Set tofalse
(the default) in security conscious environments, to makegetContext()
always returnnull
.
This way you can obtain the desired RequestDispatcher
as follows:
RequestDispatcher dispatcher = getServletContext().getContext(name).getRequestDispatcher(path);