Re: Client IP number?
"Cheong Hee (DCQSS)" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <011301c638fd$4159bfc0$1600000a@chngxp> |
Just a note. There is a slight difference between windows & unix platform
where server runs. This explains why some will not get anything when
looking for "http_host". This works for me as I have to toggle between
windows and Linux.
String hostName = context().request().headerForKey("http_host");
//windows
if (hostName == null)
hostName = context().request().headerForKey("host");
//unix/linux
Cheers
Cheong Hee
----- Original Message -----
From: "Will Scheidegger" <[email protected]>
To: "webobjects-dev Forms" <[email protected]>
Sent: Thursday, February 23, 2006 5:26 AM
Subject: Re: Client IP number?
> Thanks for the replies. Yes, context().request().hearderForKey ("host")
> will get you the name of the server the app is served from (i.e. virtual
> host). That's the reason why I posted my question in the first place. I
> then looked at all header keys but either "remote_address" was not listed
> or I missed it.
>
> So thanks again for your help.
>
> -Will
>
> On 22.02.2006, at 22:21, Denis Stanton wrote:
>
>>
>> On 23/02/2006, at 10:12 AM, Jon Nolan wrote:
>>
>>> Denis Stanton wrote:
>>>>
>>>> String hostString = context().request().headerForKey ("host");
>> <snip>
>>>
>>> Aren't host and/or http_host going to get you the server name?
>>
>> Thanks Jon
>>
>> You are right of course. My bad. I scanned an old project hurriedly,
>> found the wrong pice of code and pasted it. :-(
>>
>> I think someone else has given the correct answer, so I'll just go and
>> up my caffeine level and see if that helps
>>
>> Denis
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>