[ 
https://issues.apache.org/jira/browse/WICKET-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523860
 ] 

Marat Radchenko commented on WICKET-609:
----------------------------------------

Solution:

{code:java}
String getAbsoluteUrl(final HttpServletRequest request, final String 
servletPath) {
    final StringBuffer requestUrl = request.getRequestURL();
    final int start = requestUrl.length() - request.getServletPath().length();
    final int end = requestUrl.length();
    final StringBuffer absoluteContextPath = requestUrl.delete(start, end);
    return absoluteContextPath.append(servletPath).toString();
}
final Page page = ...
HttpServletRequest req = ...
final String servletPath = "/" + RequestCycle.get().urlFor(page);
String absolutePageUrl = getAbsoluteUrl(req, servletPath);
{code}

> Wicket should provide an easy method to generate absolute urls to 
> bookmarkable pages
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-609
>                 URL: https://issues.apache.org/jira/browse/WICKET-609
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.3.0-beta1
>            Reporter: Ryan Crumley
>            Assignee: Alastair Maw
>            Priority: Minor
>             Fix For: 1.3.0-rc1
>
>
> Currently there is no easy way to generate an absolute url for a bookmarkable 
> page. Something like getFullyQualifiedUrl(String contextRoot, Class page, 
> PageParameters parameters) would be ideal. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to