Craig,

I guess I shouldn't be surprised that you are right on the money! I hadn't
noticed that I had an old bookmark for the second page that used an IP in
the address. So as you said the host header was the IP because that's what
the browser used and so getServerName returned the IP address. Once I
changed the browser address to a name rather than an IP getServerName()
returned the name.

Thanks much for clarifying something that just kept puzzling me.

Ken


-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 27, 2003 8:57 PM
To: Tomcat Users List
Subject: Re: Where does request.getServerName get name from?




On Mon, 27 Jan 2003, Januski, Ken wrote:

> Date: Mon, 27 Jan 2003 18:03:15 -0500
> From: "Januski, Ken" <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Where does request.getServerName get name from?
>
> I know this is a simple question but just can't find the answer. I have
two
> instances of Tomcat running on one server. Each has a login page as the
> entry point and that page includes a choice of databases. I'd like the
> default database (i.e. one at top of select list) to be determined by
> request.getServername(). The problem I'm having is that I'm getting a name
> for one IP address and and IP address for the other. I can't figure out
why
> the second one won't give me a name. I can live with the IP address but
I'd
> prefer to get a name instead. Can anyone shed any light on where
> request.getServerName() gets its name from?
>

It depends very much on the precise configuration and Tomcat version
you're running.  For standalone Tomcat 4.1.x running the Coyote HTTP/1.1
connector, it comes from the "host" header included with the request,
which in turn comes from your browser based on the URL you submitted to.

> I should add that the server name is in DNS correctly and enable lookups
is
> set to true.
>
> Thanks for any info.
>

Craig



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

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

Reply via email to