You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan Adams <da...@ifactory.com> on 2005/11/15 15:50:59 UTC

getting the host name

How can i get the hostname of the current page (ie www.mycompany.com)?

-- 
Dan Adams
Software Engineer
Interactive Factory


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting the IP Address of a request

Posted by Lindsay Steele <ls...@iinet.net.au>.
Both my local test environment and the ISP I am using for testing 
(www.eatj.com) are using just straight Tomcat from what I can work out.


hv @ Fashion Content wrote:

>Do you have an Apache httpd server in front of the Servlet server?
>Or are you running a test server locally and accessing it from the same PC ?
>
>"Lindsay Steele" <ls...@iinet.net.au> skrev i en meddelelse 
>news:437A3DC6.4080904@iinet.net.au...
>  
>
>>I am trying to get the IP address of a person making a request.   I am 
>>using Tapestry 3.03 and have tried this both on a local and remote tomcat 
>>server.
>>
>>I am currently using 
>>"cycle.getRequestContext().getRequest().getRemoteAddr();" but all I get 
>>returned is 127.0.0.1
>>
>>Any ideas ?
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Getting the IP Address of a request

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
Do you have an Apache httpd server in front of the Servlet server?
Or are you running a test server locally and accessing it from the same PC ?

"Lindsay Steele" <ls...@iinet.net.au> skrev i en meddelelse 
news:437A3DC6.4080904@iinet.net.au...
>I am trying to get the IP address of a person making a request.   I am 
>using Tapestry 3.03 and have tried this both on a local and remote tomcat 
>server.
>
> I am currently using 
> "cycle.getRequestContext().getRequest().getRemoteAddr();" but all I get 
> returned is 127.0.0.1
>
> Any ideas ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Getting the IP Address of a request

Posted by Lindsay Steele <ls...@iinet.net.au>.
I am trying to get the IP address of a person making a request.   I am 
using Tapestry 3.03 and have tried this both on a local and remote 
tomcat server.

I am currently using 
"cycle.getRequestContext().getRequest().getRemoteAddr();" but all I get 
returned is 127.0.0.1

 Any ideas ?

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: getting the host name

Posted by an...@di.uoa.gr.
And finally, 
you could inject tapestry.globals.WebRequest in your page using
<inject property="webRequest" object="service:tapestry.globals.WebRequest"/>
 and do a getWebRequest().getServerName()

OR

you could just inject the servername like this:
<inject property="serverName"
object="service-property:tapestry.globals.WebRequest:serverName"/>

I prefer this last option. It's so much easier to unit-test. Otherwise, you'ld
have to mock
everything (cycle - infrastructure - webRequest).



> cycle.getInfrastructure().getRequest().getServername();
> is better, cause "getRequestContext()" is deprecated
> 
> Daniel M Garland wrote:
> 
> > Hi Dan,
> >
> > You get get at it via the Request Cycle:
> > cycle.getRequestContext().getRequest().getServerName()
> >
> > HTH
> > Dan
> >
> > Dan Adams wrote:
> >
> >> How can i get the hostname of the current page (ie www.mycompany.com)?
> >>
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: getting the host name

Posted by Rudolf Baloun <Ru...@atron.de>.
cycle.getInfrastructure().getRequest().getServername();
is better, cause "getRequestContext()" is deprecated

Daniel M Garland wrote:

> Hi Dan,
>
> You get get at it via the Request Cycle:
> cycle.getRequestContext().getRequest().getServerName()
>
> HTH
> Dan
>
> Dan Adams wrote:
>
>> How can i get the hostname of the current page (ie www.mycompany.com)?
>>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: getting the host name

Posted by Daniel M Garland <da...@titanemail.com>.
Hi Dan,

You get get at it via the Request Cycle:
cycle.getRequestContext().getRequest().getServerName()

HTH
Dan

Dan Adams wrote:
> How can i get the hostname of the current page (ie www.mycompany.com)?
> 

-- 

Dan Garland
------------------------
daniel.garland@titanemail.com
mob: +44 (0) 7979 770053
icq: 120963437
aim: dmgarland1767


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org