tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin McAllister <ke...@centraview.com>
Subject Re: Getting Host information from within webapp
Date Thu, 10 Jun 2004 14:19:57 GMT
Kevin McAllister wrote:
> I am using tomcat 4.1.29, and would like to obtain the host name 
> attribute from within my servlet code for the associated context in 
> which I am running.  I think I would be able to retrieve this 
> information utilizing the JMX stuff

Upon doing some further research I found I would be able to get a host 
name given a context as long as my webapp was privileged (so the 
org.apache.catalina.mbean.ServerLifecycleListener would place a 
reference to the MBeanServer in the ServletContext attributes) However, 
it seems the only information I would have to Query the MBeanServer is 
the context path, And if I have more than one context path which is the 
same (on different Hosts obviously) then I would not be able to uniquely 
Identify the Host to which I am bound.  And since I will most certainly 
have many Hosts each with the same context path for my webapp, this 
method will not work for my purposes.

Hopefully the information is available somewhere else, or otherwise I 
may be able to obtain it by inserting another ServerLifeCycleListener 
that can gather the information from the context adding event and put it 
on the ServletContext attributes.

- Kevin

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


Mime
View raw message