[ https://issues.apache.org/jira/browse/WICKET-5004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13612621#comment-13612621 ]
Peter Parson commented on WICKET-5004: -------------------------------------- For the sake of completeness: I have also posted a stackoverflow question about this: http://stackoverflow.com/a/13088148/1006823 In the answer I have outlined how I finally solved the problem. I just had to extract the actual page mounting out of my WebApplication class, which seemed like a drawback first, but actually I am pretty happy that the mount stuff is separate now :) That said, feel free to close this ticket if you do not think the framework should support this. At anyone needing this, have a look at the link above - actually it is pretty simple once you know it :) > Add light-weight possibility to generate URLs from Page and PageParameters > without having the WebApplication actually running. > ------------------------------------------------------------------------------------------------------------------------------ > > Key: WICKET-5004 > URL: https://issues.apache.org/jira/browse/WICKET-5004 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 6.5.0 > Reporter: Peter Parson > > In certain scenarios it is useful to be able to generate wicket URLs without > having the wicket application running, i.e. a mail notification system > running which needs to include dynamic URLs in the mails, or an XML sitemap > generator running on a different server. > With Wicket 1.3.x, this was an easy task: we just needed to (statically) > provide the UrlRequestCodingStrategy, the PageClass and PageParameters and > any other module depending on our wicket module could obtain the URLs. > With Wicket 6.x it's not so easy, it seems to be impossible without having > the application actually running. I have found the solution I have described > here: > http://stackoverflow.com/questions/13015743/how-to-obtain-wicket-url-from-pageclass-and-pageparameters-without-running-wicke > But this seems to be a little hacky, and causes problems if executed multiple > times (since the WebApplication is somewhere registered within the context, > but cannot be destroyed) > A code example from our old (1.3.x) solution, to give you an idea of what we > did. > We had a spring bean in our Wicket module which offered methods like this: > public String getUrlFor(MyDomainObject o) { > Class pClass = MyDomainObjectTargetPage.class; > PageParameters pp = MyDomainObjectTargetPage.pageParametersFor(o); > IRequestTargetUrlCodingStrategy urlCodingStragy = > MyDomainObjectTargetPage.URL_CODING_STRATEGY; > BookmarkablePageRequestTarget target = new > BookmarkablePageRequestTarget(pClass, pp); > return "/" + urlCodingStragy.encode(target).toString() > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira