|
Yes..infact, using request to get the
RequestDispatcher() only works to forward to paths relative to that of request
URI path itself. It is not relative to the ServletContext the request handler is
running in (request handler being the ControllerServlet).
I
solved it by adding a context="" parameter for each forwarding resource in my
framework. Now, if a resource to be forwarded to exists in another web-app
context, simply add the context="/web-app-context" to the resource forwarding
declaration will allow it to use that context instead. You'd have to use my
Theseus framework (www.brainopolis.com/theseus) to
see it in use.
The
trick is to grab the ServletContext of the web-app you want to forward to, then
forward using a relative path to the root of THAT ServletContext. I was grabbing
the right ServletContext, but was forwarding relative to the root web-app
context "/", and not of the one I wanted to go into "/inside" or
"/admin".
Seems
to work fine now. Funny thing is, I don't think Struts handles this correctly.
Not sure, but looking at the source on how Struts forwards to a resource, its
done the same way I was doing it before. I could be wrong..perhaps somewhere in
that huge list of code there is a bit that grabs the ServletContext of the
desired web-app, but I couldn't find it. What this means is that Struts will not
allow you to properly forward from inside one deployed web-app into another
web-app running in the same JVM. I will suggest this fix to the Struts team so
that possibly this will work for them as well.
|
- Working with multiple WAR files in a single container? Duffey, Kevin
