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]



Reply via email to