You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ia...@barclayscapital.com on 2005/12/22 11:17:16 UTC

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

Frank,

> > 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?

Yeah I thought about that... unfortunately I can't be sure that the
users will enter from the homepage or any other particular point.


> 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 :)

Although, how would the startup servlet know what the magic URL is? I
guess it would have to start with the full URL of the app. Which is
where we came in :)

Doesn't matter anyhow, it's working ok... Thanks a lot for your help.

Iain


------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


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


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

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Iain.Shepherd@barclayscapital.com wrote:
>>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?
> 
> 
> Yeah I thought about that... unfortunately I can't be sure that the
> users will enter from the homepage or any other particular point.

Yeah, I thought you might say that :)

>>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 :)
> 
> 
> Although, how would the startup servlet know what the magic URL is? I
> guess it would have to start with the full URL of the app. Which is
> where we came in :)

The startup servlet wouldn't, the filter would.  The servlet just
requests a resource in your webapp, and the filter calculates the URL
and sticks it in application scope.

> Doesn't matter anyhow, it's working ok... Thanks a lot for your help.

Your right, and I'm glad its working.  The other suggestion is just a
curiosity at this point :)  Take care!

> Iain

Frank


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