Hi,

you could try with the following solution:

- Mount a stateless page on your desired path (let's say "/home")
- This page should do nothing but redirect user to your stateful page, but instead of creating a new instance of it each time, it will save into session your stateful page to use it for the next requests. Its constructor should look like this:

        Page page = null;

        if(Session.get().getAttribute("page") == null){
            Session.get().bind();
            page = new YourPage();
            Session.get().setAttribute("page", page);
        }else{
            page =(Page) Session.get().getAttribute("page");
        }

        setResponsePage(page);


Inside YourPage you should anyway call serVersioned(false).
One more thing --> I don't see any use in versioning in my case: My base page 
is stateful though that means each and every link I use will lead to a new version 
number polluting the user's browser history with all the same link even though 
there has NOTHING changed on the page!? Please, there has to be a way to turn that 
off.. I was trying to return a PageManager that returns supportsVersioning = false 
still no effect..

NOTE: I do not want to only get this out of the url but I want to get RID of 
this feature as it pollutes the session by storing a serialized version of all 
but the same page...

thanks!!
Alex


Am 18.07.2012 um 14:08 schrieb Josh Kamau:

Now create something like this

public class CleanUrlMapper extends MountedMapper {

  public CleanUrlMapper(String mountPath, Class<? extends IRequestablePage>
pageClass) {
    super(mountPath, pageClass, new PageParametersEncoder());
  }

  @Override
  protected void encodePageComponentInfo(Url url, PageComponentInfo info) {
    // do nothing so that component info does not get rendered in url
  }

  @Override
  public Url mapHandler(IRequestHandler requestHandler)
  {
      if (requestHandler instanceof ListenerInterfaceRequestHandler) {
          return null;
      } else {
           return super.mapHandler(requestHandler);
      }
  }
}

and then mount your pages like this

mount(new CleanUrlMapper("/home", HomePage.class));


Atleast thats what i do to achieve something like what you want.

Josh.

On Wed, Jul 18, 2012 at 2:53 PM, Alexander Adam, Emia Systems <
a...@emiasys.com> wrote:

Hi!

I am pretty much lost with Wicket 1.5.7 and versioning. What happens is
this: I've deactivated versioning by setting serVersioned(false) in my
page's constructor.
However, still the page id gets increment each time I call the exact same
url in my browser i.e. home/?0, home/?1, home/?2, etc.
I simply don't want this behavior, I want to have a stateful page with
*exactly* one state at a given time for a given user, not more. How can I
do that?
I want page refreshes to destroy anything ajax might have created and the
such still, I want to be stateful to properly use forms, clickable links
etc..

please advise, I'm almost giving up :(

thank you!!
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to