On 6/23/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
>
> On 6/23/05, Brad Johanson <[EMAIL PROTECTED]> wrote:
> > 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).
> 
> Maybe InetAddress can help you?

Thank you for the suggestion.  That will give me an IP address for the
machine (and DNS name if there is one) of one of the interfaces on the
machine (the primary?).  Like so:

String IP=InetAddress.getLocalHost().getHostAddress();

This is what I'm actually doing right now to get the main IP/DNS. 
What it doesn't give me is the port on which tomcat is listening. 
That is specified in the conf/server.xml file, but I can't figure out
how to access that information from within the servlet code.  For now
I'm passing it in as a system property, but this is not very elegant
or portable.  It would be nicer to just be able to ask Tomcat directly
since it is already configured somewhere in the tomcat active state.

-Brad

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

Reply via email to