webapplication {
protected IRequestCycleProcessor newRequestCycleProcessor()
 {
        return new WebRequestCycleProcessor() {
           protected IRequestCodingStrategy newRequestCodingStrategy() {
              return new MyStrategy();<===

also make yours either extend WebRequestCodingStrategy or chain to it.

-igor


On Thu, Jan 27, 2011 at 11:00 AM,  <[email protected]> wrote:
> Thanks Igor,
>
> i checked the settings but couldn't find anything what i could use to solve 
> my problem.
> Can you please push me a bit further and tell me what i can do to map the url 
> to a page with appropriate parameters.
>
> Thanks again
> Mike
>
> -------- Original-Nachricht --------
>> Datum: Thu, 27 Jan 2011 08:04:53 -0800
>> Von: Igor Vaynberg <[email protected]>
>> An: [email protected]
>> Betreff: Re: Can i catch urls like 
>> "http://localhost:8080/ShowThemePage-ti325-Twilight.html"; by 
>> IRequestTargetUrlCodingStrategy?
>
>> instead of mounting it set in the settings. mounting is for
>> intercepting path segments.
>>
>> also set a breakpoint and see if its being hit.
>>
>> -igor
>>
>>
>> On Thu, Jan 27, 2011 at 2:56 AM, Mike Mander <[email protected]> wrote:
>> > Hi,
>> >
>> > urls in my shop look like this
>> > <code>
>> > http://localhost:8080/ShowThemePage-ti325-Twilight.html
>> > </code>
>> > ShowThemePage should be mapped to my ThemePage.class
>> > The ti325 and Twilight Tokens should be indexed parameters
>> > and the .html is for ornament.
>> >
>> > Until now i mounted my own Strategy in my application.init
>> > <code>
>> >            mount(new ThemeUrlCodingStrategy());
>> > </code>
>> >
>> > The strategy looks like
>> > <code>
>> > import org.apache.wicket.IRequestTarget;
>> > import org.apache.wicket.PageParameters;
>> > import org.apache.wicket.request.RequestParameters;
>> > import
>> >
>> org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy;
>> > import
>> >
>> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
>> > import
>> >
>> org.apache.wicket.request.target.component.IBookmarkablePageRequestTarget;
>> > import org.apache.wicket.util.string.AppendingStringBuffer;
>> >
>> > import de.shop.shopping.ThemePage;
>> >
>> > public class ThemeUrlCodingStrategy extends
>> > AbstractRequestTargetUrlCodingStrategy {
>> >
>> >    public ThemeUrlCodingStrategy() {
>> >        super("ShowThemePage");
>> >    }
>> >
>> >    @Override
>> >    public CharSequence encode(IRequestTarget requestTarget) {
>> >        AppendingStringBuffer url = new
>> > AppendingStringBuffer("ShowThemePage-ti");
>> >        IBookmarkablePageRequestTarget target =
>> > (IBookmarkablePageRequestTarget) requestTarget;
>> >        PageParameters parameters = target.getPageParameters();
>> >
>> >
>>  url.append(urlEncodePathComponent(String.valueOf(parameters.get("ti")))).append("-").append(urlEncodePathComponent(escape(String.valueOf(parameters.get("name")))));
>> >        return url.append(".html");
>> >    }
>> >
>> >    private String escape(String value) {
>> >        return value == null ? null : value.replaceAll(" ", "_");
>> >    }
>> >
>> >    @Override
>> >    public IRequestTarget decode(RequestParameters requestParameters) {
>> >        return new BookmarkablePageRequestTarget(ThemePage.class, new
>> > PageParameters("ti=99, name=Hello_kitty")); // for testing use constant
>> > parameters
>> >    }
>> >
>> >    @Override
>> >    public boolean matches(IRequestTarget requestTarget) {
>> >        if (requestTarget instanceof IBookmarkablePageRequestTarget)
>> {
>> >            IBookmarkablePageRequestTarget target =
>> > (IBookmarkablePageRequestTarget) requestTarget;
>> >            return
>> ThemePage.class.isAssignableFrom(target.getPageClass());
>> >        }
>> >        return false;
>> >    }
>> > }
>> > </code>
>> >
>> > But all i get is a 404 for page not found. Do i have to implement
>> something
>> > else?
>> >
>> > Thanks for help
>> > Mike
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [email protected]
>> > For additional commands, e-mail: [email protected]
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to