You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Algirdas <al...@gmail.com> on 2010/03/17 20:35:38 UTC

How to create absolute URL?

For registration process, I need to send user an email with an absolute link
to my site, which finalizes the
registration, that is, full URL with protocol (may be https), site name,
page & parameters:

http://www.somemysite.com/register/p=RTWE343434dsfdf3435353sfsdfsdfdsf


Is there a way from Tapestry (5.1.0.5) to generate such URL?
-- 
View this message in context: http://n2.nabble.com/How-to-create-absolute-URL-tp4752509p4752509.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: How to create absolute URL?

Posted by Dariusz Majewski <da...@gmail.com>.
Hi,

    Not sure that this is the best way, but I did it like this:

    @Inject
    private Request request;

    @Inject
    private RequestGlobals requestGlobals;

    public String getHostUrl(){
        if(hostUrl == null){
            hostUrl =
getRequestGlobals().getHTTPServletRequest().getScheme()+"://";
            hostUrl += getRequest().getServerName();
            if(getRequestGlobals().getHTTPServletRequest().getServerPort()
!= 80){
                hostUrl +=
":"+getRequestGlobals().getHTTPServletRequest().getServerPort();
            }
        }
        return hostUrl;
    }

--
Cheers,
Dariusz


On Wed, Mar 17, 2010 at 7:35 PM, Algirdas <al...@gmail.com> wrote:

>
> For registration process, I need to send user an email with an absolute
> link
> to my site, which finalizes the
> registration, that is, full URL with protocol (may be https), site name,
> page & parameters:
>
> http://www.somemysite.com/register/p=RTWE343434dsfdf3435353sfsdfsdfdsf
>
>
> Is there a way from Tapestry (5.1.0.5) to generate such URL?
> --
> View this message in context:
> http://n2.nabble.com/How-to-create-absolute-URL-tp4752509p4752509.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>