You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jonathan and Carrie Olson <ol...@gmail.com> on 2009/07/10 07:23:45 UTC

Re: Is IRequestTargetUrlCodingStrategy needed for mapping bookmarkable URLs?

Thank you, I'll try that type of implementation out!

-Jonathan Olson

On Thu, Jul 9, 2009 at 5:42 AM, Alex Objelean <al...@yahoo.com>wrote:

>
> I did something similar. All you have to do is to create your own
> implementation of IRequestCodingStrategy.
> You can find the code at this link:  http://pastebin.com/m70f62424
> LocaleUrlCodingStrategyDecorator
> This implementation is a decorator which depends also on this class:
> http://pastebin.com/m2c92dacb RequestCodingStrategyDecorator
>
> The usage is pretty simple, add the following in you Application:
> [CODE]
>  /**
>   * {@inheritDoc}
>   */
>  @Override
>  protected IRequestCycleProcessor newRequestCycleProcessor() {
>    return new WebRequestCycleProcessor() {
>        @Override
>      protected IRequestCodingStrategy newRequestCodingStrategy() {
>        return new
> LocaleUrlCodingStrategyDecorator(super.newRequestCodingStrategy());
>      }
>    }
>  }
>
> [CODE]
>
>
> Alex Objelean
>
>
> Jonathan and Carrie Olson wrote:
> >
> > Hello,
> >
> > I've been investigating Wicket for building an educational site, and
> > there's
> > one issue that's been nagging me:
> >
> > The majority of our URLs would need to be pretty, bookmarkable, and start
> > with a locale, like:
> > http://www.example.com/en/test/1
> > or
> > http://www.example.com/zh_CN/page-search/penguin
> > Where the "en" and "zh_CN" are the locales to be used, usually followed
> by
> > one or more slash-separated tokens that uniquely identify a page,
> followed
> > by zero or more slash-separated tokens that are parameters. Ideally, the
> > locale and parameters would be passed into a WebPage with the
> > PageParameters.
> >
> > Is there an elegant way to accomplish this? I've resorted to having the
> > application mount a custom class implementing
> > IRequestTargetUrlCodingStrategy for each locale ("en", "zh_CN"), that
> adds
> > the locale to the page parameters, and then uses regular expressions to
> > identify the class of the Page. This seems like somewhat of a hack, where
> > encode(IRequestTarget) is left unimplemented and using links seems more
> > difficult.
> >
> > -Jonathan Olson
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Is-IRequestTargetUrlCodingStrategy-needed-for-mapping-bookmarkable--URLs--tp24407411p24409330.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Save trees! Don't print this email unless it's absolutely necessary.
----------