You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Frank W. Zammetti" <fz...@omnytex.com> on 2005/12/21 19:36:20 UTC

RE: ServletContextListener - how to detect http path of web application?

On Wed, December 21, 2005 1:10 pm, Iain.Shepherd@barclayscapital.com said:
> Frank, your solution (using the ServletContext) does work. Thanks.

Good news (sigh of relief!)

> Martin, I can't get a HttpServletRequest from Filter.init.
> I can get a ServletContext... but I can also get that from a
> ServletContextListener.
> So I can throw away this silly Filter now.

One reason a filter would be better is you can fully construct the URL
dynamically, including the method and all that.  Could you possibly map it
to just the initial entry point of your app so that it doesn't fire with
each request?

Another even more hack-ey solution might be to have a servlet that runs on
startup, and from it fire off a request to a specific URL that goes
through your filter.  Your filter then calculates the app's URL and sticks
it in application scope.  The servlet is no longer needed, nor is the
filter, and shouldn't affect anything after that.

Seems like a lot of trouble for what your after though :)

Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org