Ok, here is my code. Perhaps the way I (ab)use HybridUrlCodingStrategy
is what made the URLs change.

In the ctor of ChangePasswordPage:

Form<PasswordObject> form = new Form<PasswordObject>("form", new 
CompoundPropertyModel<PasswordObject>(passwordObject)) {
  protected void onSubmit() {
    try {
      getSession().authenticateMemberByCredentials(me.getEmail(), 
passwordObject.getPassword(), true);
      ... update password ...
      info(getLocalizer().getString("form.info.password.changed", this));
      setResponsePage(new AccountPage());
    } catch (AuthenticationFailure authenticationFailure) {
      error(getLocalizer().getString("form.error.wrongpassword", this));
    }
  }
};

and in Application#init():

mount(new NonVersionedHybridUrlCodingStrategy("settings/account", 
AccountPage.class));
mount(new NonVersionedHybridUrlCodingStrategy("settings/account/password", 
ChangePasswordPage.class));

NonVersionedHybridUrlCodingStrategy looks like this:

    /**
     * Variant of Wicket's HybridUrlCodingStrategy.
     * Use this URL coding strategy in the frontend for non versioned pages
     * (call setVersioned(false) in the constructor) that have some kind of
     * feedback (e.g. a form submit).
     */
    private static class NonVersionedHybridUrlCodingStrategy extends 
HybridUrlCodingStrategy {

        public NonVersionedHybridUrlCodingStrategy(String mountPath, Class<? 
extends Page> pageClass) {
            super(mountPath, pageClass);
        }

        @Override
        protected String addPageInfo(String url, PageInfo pageInfo) {
            // Do not add the version number as super.addPageInfo would do.
            return url;
        }
    }


Regards,
     Erik.



Mathias P.W Nilsson wrote:
> Can you please elaborate. 
>
> I have this Link in my List class
> Link itemLink = new Link( "itemLink", listItem.getModel() ){
>   @Override
>   public void onClick() {
>     PageParameters parameters = new PageParameters();
>     parameters.add( "ItemId", ((Item)getModelObject()).getId().toString());
>     ItemPage itemPage = new  ItemPage( parameters, ItemListPage.this );
>     itemPage.setRedirect( true );
>     setResponsePage( itemPage  );
>   }
> };
> This will produce url like wicket:interface=:2::::
>
> In My application class I have tried a number of mounting but without
> success. Any more pointers?
> I use the reference for the ItemListPage to go back from ItemPage to
> ItemListPage plus I use the same background as in the ItemListPage.
>
> If a google spider where to index this it would not be successful so I need
> a way to get this to be bookmarkable.
>   

-- 

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to