Re: Client IP number?

Denis Stanton <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
On 23/02/2006, at 6:57 AM, Will Scheidegger wrote:

> I have searched the web, archives and both wodev.com and wocode.com  
> for something that I thought would be very easy... How can I get  
> the IP# the request came from? I'm sure I've seen this before -  
> maybe I have already done it, but for now I cannot find a quick  
> solution.

Very roughly

         String hostString = context().request().headerForKey ("host");
         if (hostString == null)
             hostString = context().request().headerForKey  
("http_host");


I check both host and http_host in there because some build of apache  
changed this and I can't remember which is now current. (this is old  
code from a previous project)

Remember that this host address is being inserted into the header by  
Apache.  if you are working on WebObjects in developer mode you won't  
get a host address

Denis

Denis Stanton
[email protected]

_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.