Thanks very much for your considered reply. You both solved my problem and made me question my approach at the same time.
In re-thinking this in terms of separated webapps, I've hit another issue. If I solve this problem within one particular web application, I have to be able to point this webapp to another place in the file system (other than $CATALINA_HOME/webapp). I had figured out how to do that with the ROOT application, but I'm not sure how to do this within a war file.
In short, how does one deploy a war file such that it looks for content ("/images/whatever.gif") in a configurable location in the file system?
If I can figure that out, I think I can abandon the cross-context issue for good!
Thanks,
Fred
At 10:23 PM 5/10/2004, you wrote:
At 07:04 PM 5/10/2004, you wrote:Hi,
I'm trying to install a filter into the default context that forwards to my application (in another context) and it doesn't seem to want to work. (jboss 3.2.3 with embedded tomcat 4.1.29)
In researching this, I've seen various hints that this may in fact be illegal. Can anyone confirm?
It is generally good design practice to limit interactions between your webapps except for strongly defined specific interfaces that promote modularity. Doing something like you're suggesting will likely lead to messy, difficult code to work with ... not because it's a necessarily bad design idea, but rather because the premise behind J2EE is that code bases are designed, coded, deployed, and maintained as independent applications. They're not meant to ineroperate in a fluid way. It's possible to do what you're suggesting, but not recommended.
The REASON I want to do this is that I want to be able to take advantage of "simple" URLS with the default context, as in "/images/whatever.gif", and have them be served by DefaultServlet, which conveniently knows how to handle all that sort of stuff, set mime types, etc. I'm also hoping that DefaultServlet was written by someone more clever than me!
Resources need not be within the ROOT web application to be served by the DefaultServlet. You'll notice that the DefaultServlet is defined within the global web.xml (I haven't worked with recent versions of jBoss, so I'm not sure exactly where they put this these days), which means that all applications inherit it. This means that resources like "/images/whatever.gif" and "/mywebapp/images/whatever.gif" will both be served by the DefaultServlet unless you configure it otherwise.
But, I also want to capture certain "simple" URLs and forward these to another context. As in "/protected.html" needs to be forwarded to "/accesscheck/protected.html" or similar.
Am I on the wrong track here? Is it possible to forward (via RequestDispatcher) from one context to another? If not, how can I take advantage of DefaultServlet in my application?
See ServletContext#getContext(String). Again, I predict you'll find this to be a clunky and frustrating way to do things. Unless you have an over-riding reason to do otherwise, embrace the idea of separate and distinct web applications and let the container do this URL parsing and forwarding for you.
Many thanks,
Fred Toth
Good luck, justin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]