I hope this is the right place to post this-- I've searched the web,
usenet, and archives of this and the tomcat-user mailing list with no
success.

I have a Servlet I'm developing that uses a singleton to collect
network traffic information through socket-based non-web/servlet
mechanisms.  The singleton gets loaded at startup since the servlet
loads at startup.  Users access the servlet page to view the latest
stats which are retrieved from the singleton.

Now the problem:  the server may run on a variety of machines, and
clients use an out of band mechanism to retrieve the URL to use to
access the servlet.  They do this by contacting the singleton (which
has its own threads for socket based communication), then trigger
display of the returned URL in the local web browser.  The problem I'm
running into is how the singleton can find the root URL/server URL
(and port) for the Tomcat server in which it is running (for example,
http://167.7.9.95:8080 or http://www.foo-co.com).  Once I have that
information I can append the root-relative path to the actual servlet.

Does anybody have any suggestions on how to get this information?  I
need to be able to do so before any requests come in, since the first
request won't happen until the singleton sends out the address to use.
 There don't appear to be any methods of ServletContext() that yield
this information, nor do their to appear to be any servlet context
attributes set by tomcat with this information.  I can figure it out
from an HttpServletRequest object, but as I said, I won't receive one
of those until later.

If this is a bad idea for some reason, let me know, and please offer a
better way of going about this.

Thanks,

-Brad

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to