I use wicket 1.4.1, and I want send e-mail's notifications to users. I create problem code as simple as possible: only with AjaxLink Users of my site send internal messages. Messages will be composed in ModalWindow. Inside AjaxButton.onSumbit method e-mail notification sent. (Long way to carry absoluteUrl through container hierarchy).
-- Rzhevskiy Dmitry 2009/9/12 Johan Compagner <jcompag...@gmail.com> > Which version of wicket do you use? > > Why do you need absoluut urls? > > On 11/09/2009, Dima Rzhevskiy <d...@rzhevskiy.info> wrote: > > Sorry, yes, urlFor return correct result. > > toAbsolutePath(final String relativePagePath) do not return result what I > > expected. > > javadoc copy/pasted from toAbsolutePath(final String requestPath, String > > relativePagePath)... > > > > I undestand that it is nessesary to use toAbsolutePath(final String > > requestPath, String relativePagePath) where requestPath nessesaty take in > > constructor: > > > > public class X1 extends WebPage { > > > > private static final Logger LOG = LoggerFactory.getLogger(X1.class); > > > > public X1(final PageParameters parameters) { > > > > CharSequence url = getRequestCycle().urlFor(getClass().class, > new > > PageParameters()); > > final String outerUrl2= > > RequestUtils.toAbsolutePath(url.toString()); //get > > add(new AjaxLink("message"){ > > @Override > > public void onClick(AjaxRequestTarget ajaxRequestTarget) { > > CharSequence url = > > getRequestCycle().urlFor(X1.class, new PageParameters()); > > String url2= > > RequestUtils.toAbsolutePath(outerUrl2, url.toString()); > > LOG.info("url="+url); > > LOG.info("url2="+url2); > > } > > }); > > > > } > > } > > > > > > But this code look ugly.. > > Is better way of obtaining absolute url exists ? > > > > -- > > Rzhevskiy Dmitry > > > > > > 2009/9/11 Jeremy Thomerson <jer...@wickettraining.com> > > > >> what is incorrect about those URLs? they are relative - relative to the > >> path you are on. > >> > >> -- > >> Jeremy Thomerson > >> http://www.wickettraining.com > >> > >> > >> > >> On Fri, Sep 11, 2009 at 10:14 AM, Dima Rzhevskiy <d...@rzhevskiy.info > >> >wrote: > >> > >> > Hi ! > >> > > >> > I create simple page X1 with AjaxLink : > >> > .. > >> > new AjaxLink("message"){ > >> > @Override > >> > public void onClick(AjaxRequestTarget ajaxRequestTarget) { > >> > CharSequence url = > >> > getRequestCycle().urlFor(X1.class, new PageParameters()); > >> > String url2= > >> > RequestUtils.toAbsolutePath(url.toString()); > >> > LOG.info("url="+url); > >> > LOG.info("url2="+url2); > >> > } > >> > } > >> > ... > >> > if I mount page to first level directory , for example "/x1.html" > >> > result is correct: > >> > url=x1.html > >> > url2=http://localhost:8080/ctx/x1.html > >> > > >> > if I mount page to second level directory "/x1/x2.html" result > incorrect > >> > url=../x1/x2.html > >> > url2=http://localhost:8080/x1/x2.html > >> > > >> > if i mount ti third level directory "/x1/x2/x3.html" > >> > url=../../x1/x2/x3.html > >> > url2=http://x1/x2/x3.html > >> > > >> > Is this bug or I use API incorrectly ? > >> > > >> > -- > >> > > >> > Rzhevskiy Dmitry > >> > > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >