Re: How to get IP address Tomcat bound to.

2003-01-26 Thread Craig R. McClanahan


On Sun, 26 Jan 2003, Kirill Maximov wrote:

> Date: Sun, 26 Jan 2003 16:57:17 +0300
> From: Kirill Maximov <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: How to get IP address Tomcat bound to.
>
>   I have a programming question - how can I get
>   the IP address the TomCat is bound to ? Is this possible?
>
>   I suppose, I have to use some internal TomCat API here ..
>

How Tomcat binds is based on the parameters to the attributes of your
 element.  By default, it will bind on all attached IP
addresses, but you can limit it to one by using an "address" attribute on
the  -- see the config docs for more:

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/

There is no portable API to retrieve this information from a servlet,
however.

On a given request, you can ask which address the request was received on
by calling request.getServerAddr().

>   With kind regards,
>   Kirill Maximov
>

Craig


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




RE: How to get IP address Tomcat bound to.

2003-01-26 Thread Mark
Good question...and I don't know the answer.  I've never deployed on a host 
with more than one IP address.  Out of curiousity, any idea what IP address 
might be returned?

At 1/26/2003 02:31 PM, you wrote:

How does this help if there are multiple IP addresses on a single host?

John


-Original Message-
From: Kirill Maximov [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 26, 2003 2:04 PM
To: Tomcat Users List
Subject: Re: How to get IP address Tomcat bound to.


On  0, Mark <[EMAIL PROTECTED]> wrote:
> At 1/26/2003 04:57 PM, you wrote:
> >  I have a programming question - how can I get
> >  the IP address the TomCat is bound to ? Is this possible?
> >
> >  I suppose, I have to use some internal TomCat API here ..
> >
> >  With kind regards,
> >  Kirill Maximov
>
> Not sure if I understand your question, but will this work for you
> from w/i
> a servlet or other class running under Tomcat?
>
>String ipaddr = InetAddress.getLocalHost().getHostAddress();

  Thanks a lot, that's what I was looking for!



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




RE: How to get IP address Tomcat bound to.

2003-01-26 Thread Turner, John

How does this help if there are multiple IP addresses on a single host?

John


-Original Message-
From: Kirill Maximov [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, January 26, 2003 2:04 PM
To: Tomcat Users List
Subject: Re: How to get IP address Tomcat bound to.


On  0, Mark <[EMAIL PROTECTED]> wrote:
> At 1/26/2003 04:57 PM, you wrote:
> >  I have a programming question - how can I get
> >  the IP address the TomCat is bound to ? Is this possible?
> >
> >  I suppose, I have to use some internal TomCat API here ..
> >
> >  With kind regards,
> >  Kirill Maximov
> 
> Not sure if I understand your question, but will this work for you 
> from w/i
> a servlet or other class running under Tomcat?
> 
>String ipaddr = InetAddress.getLocalHost().getHostAddress();

  Thanks a lot, that's what I was looking for!

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

-- 
Kirill Maximov aka KIR


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

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
 

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
 

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




Re: How to get IP address Tomcat bound to.

2003-01-26 Thread Kirill Maximov
On  0, Mark <[EMAIL PROTECTED]> wrote:
> At 1/26/2003 04:57 PM, you wrote:
> >  I have a programming question - how can I get
> >  the IP address the TomCat is bound to ? Is this possible?
> >
> >  I suppose, I have to use some internal TomCat API here ..
> >
> >  With kind regards,
> >  Kirill Maximov
> 
> Not sure if I understand your question, but will this work for you from w/i 
> a servlet or other class running under Tomcat?
> 
>String ipaddr = InetAddress.getLocalHost().getHostAddress();

  Thanks a lot, that's what I was looking for!

> 
> 
> --
> To unsubscribe, e-mail:   
> 
> For additional commands, e-mail: 
> 

-- 
Kirill Maximov aka KIR


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: How to get IP address Tomcat bound to.

2003-01-26 Thread Mark
At 1/26/2003 04:57 PM, you wrote:

  I have a programming question - how can I get
  the IP address the TomCat is bound to ? Is this possible?

  I suppose, I have to use some internal TomCat API here ..

  With kind regards,
  Kirill Maximov


Not sure if I understand your question, but will this work for you from w/i 
a servlet or other class running under Tomcat?

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


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



How to get IP address Tomcat bound to.

2003-01-26 Thread Kirill Maximov
  I have a programming question - how can I get 
  the IP address the TomCat is bound to ? Is this possible?

  I suppose, I have to use some internal TomCat API here ..

  With kind regards,
  Kirill Maximov


-- 
Kirill Maximov aka KIR
[EMAIL PROTECTED] | http://www.maxkir.com/


--
To unsubscribe, e-mail:   
For additional commands, e-mail: