> try with
> requestCycle.getUrlRenderer().renderFullUrl(Url.parse(relativePath))

This:

String url2 = 
RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(urlFor(ActivationPage.class,
null).toString()));

outputs:
http://localhost:8080/../login/ActivationPage

This link is wrong b/c of the .. in it. Did I use it wrong?


My method based on the original one:

public final static String toAbsolutePath(final String relativePagePath)
    {
        HttpServletRequest req = (HttpServletRequest)
((WebRequest)RequestCycle.get().getRequest()).getContainerRequest();
        return RequestUtils.toAbsolutePath(req.getRequestURL().toString(),
relativePagePath);
    }

outputs:
http://localhost:8080/login/ActivationPage

This doesn't abstract the low level request, but what else should it
be than a HttpServletRequest??

Best regards,
Christian



>
> this is new method which will be available in 1.5-RC2
>
> let us know if you face problems
>
> On Wed, Feb 16, 2011 at 3:21 PM, Christian Grobmeier 
> <[email protected]>wrote:
>
>> Hi,
>>
>> with commit 895520 from 04.01.2010 the
>> RequstUtils.toAbsolutePath(final String relativePagePath) method
>> disappeared without warning
>>
>> This one was very useful and has never marked as deprecated. I am
>> wondering if this was by accident - the commit was very huge. It was
>> the RequestCycle refactoring.
>>
>> The method in questions is:
>>
>> /**
>>         * Calculates absolute path to url relative to another absolute url.
>>         *
>>         * @param relativePagePath
>>         *            path, relative to requestPath
>>         * @return absolute path for given url
>>         */
>>        public final static String toAbsolutePath(final String
>> relativePagePath)
>>        {
>>                HttpServletRequest req =
>> ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest();
>>                return toAbsolutePath(req.getRequestURL().toString(),
>> relativePagePath);
>>        }
>>
>> Best regards,
>> Christian
>>
>> --
>> http://www.grobmeier.de
>>
>



-- 
http://www.grobmeier.de

Reply via email to