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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 



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

Reply via email to