Wicket
  1. Wicket
  2. WICKET-497

For stateless mounted page incorrect url is generated

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.3.0-beta1
    • Fix Version/s: 1.3.0-beta4
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      wicket-1.3.0-incubating-snapshot.jar from 21 Apr 2007

      Description

      There is no redirect by default if I use setResponsePage(new Home()) inside onSubmit() handler. If set redirect explicitly, after login from stateless SignIn page the url contains form submission listener. Example: http://localhost:8888/app/signin/wicket:interface/%3A0%3AsignInForm%3A%3AIFormSubmitListener%3A?wicket:interface=:1:::.

        Issue Links

          Activity

          Hide
          Shumbola added a comment -

          Here is an example code, look for //*:

          public final class SignIn extends WebPage
          {
          public SignIn()

          { add(new FeedbackPanel("feedback")); add(new SignInForm("signInForm")); }

          public final class SignInForm extends StatelessForm
          {
          private final ValueMap properties = new ValueMap();

          public SignInForm(final String id)

          { super(id); add(new RequiredTextField("username", new PropertyModel(properties, "username"))); add(new PasswordTextField("password", new PropertyModel(properties, "password"))); }

          public final void onSubmit()
          {

          if ( ("user".equals(properties.getString("username")) && "password".equals(properties.getString("password")))
          {
          if(session.isTemporary())

          { session.bind(); }

          if (!continueToOriginalDestination())

          { RequestCycle.get().setRedirect(true); setResponsePage(new Home()); //no matter using explicit redirect or not, this adds form listener to the URL //* setResponsePage(Home.class); does work !!! }

          } else

          { error("username or password wrong"); }

          }
          }
          }

          Show
          Shumbola added a comment - Here is an example code, look for //*: public final class SignIn extends WebPage { public SignIn() { add(new FeedbackPanel("feedback")); add(new SignInForm("signInForm")); } public final class SignInForm extends StatelessForm { private final ValueMap properties = new ValueMap(); public SignInForm(final String id) { super(id); add(new RequiredTextField("username", new PropertyModel(properties, "username"))); add(new PasswordTextField("password", new PropertyModel(properties, "password"))); } public final void onSubmit() { if ( ("user".equals(properties.getString("username")) && "password".equals(properties.getString("password"))) { if(session.isTemporary()) { session.bind(); } if (!continueToOriginalDestination()) { RequestCycle.get().setRedirect(true); setResponsePage(new Home()); //no matter using explicit redirect or not, this adds form listener to the URL //* setResponsePage(Home.class); does work !!! } } else { error("username or password wrong"); } } } }
          Hide
          Alastair Maw added a comment -

          I have just fixed a related issue to this. Can you try again and see if this now works?

          Show
          Alastair Maw added a comment - I have just fixed a related issue to this. Can you try again and see if this now works?
          Hide
          Alastair Maw added a comment -

          This now works properly regardless of whether you manually call setRedirect or not. It is actually a duplicate of WICKET-526.

          Show
          Alastair Maw added a comment - This now works properly regardless of whether you manually call setRedirect or not. It is actually a duplicate of WICKET-526 .
          Hide
          Shumbola added a comment -

          Sorry, I was busy, but I manged to test this with June 11 snapshot. I see no difference. Exception from this behavior is when set response page to be Home.class, instead new Home(). And If I do not call setRedirect manually, after logging in, if i hit F5 (refresh) it asks me repost the data.

          Show
          Shumbola added a comment - Sorry, I was busy, but I manged to test this with June 11 snapshot. I see no difference. Exception from this behavior is when set response page to be Home.class, instead new Home(). And If I do not call setRedirect manually, after logging in, if i hit F5 (refresh) it asks me repost the data.
          Hide
          Martijn Dashorst added a comment -

          Next release

          Show
          Martijn Dashorst added a comment - Next release
          Hide
          Alastair Maw added a comment -

          If you want this fixing, please can you provide a quickstart?

          Show
          Alastair Maw added a comment - If you want this fixing, please can you provide a quickstart?
          Hide
          Matej Knopp added a comment -

          I wouldn't be surprised that this doesn't work because of continueToOriginalDestination() which relies on (bound) session.

          Show
          Matej Knopp added a comment - I wouldn't be surprised that this doesn't work because of continueToOriginalDestination() which relies on (bound) session.
          Hide
          Oli Evans added a comment -

          Uploading a quickstart for this issue. it is a zip of an eclipse project, created via the mvn achetype command.
          This is my first quickstart so let me know if there is a better way of packaging it, or you need anything else.

          Oli

          Show
          Oli Evans added a comment - Uploading a quickstart for this issue. it is a zip of an eclipse project, created via the mvn achetype command. This is my first quickstart so let me know if there is a better way of packaging it, or you need anything else. Oli
          Hide
          Johan Compagner added a comment -

          Oli,

          you can easily fix the example you have there. Just place one extra setRedirect(true) besides the setResponsePage() call.
          But that should be default by form processing anyway. So i changed the statelessform that it sets the redirect boolean in the process method.

          A redirect will not happen when you make errors on your form. Because that is not possible for a stateless page.

          Show
          Johan Compagner added a comment - Oli, you can easily fix the example you have there. Just place one extra setRedirect(true) besides the setResponsePage() call. But that should be default by form processing anyway. So i changed the statelessform that it sets the redirect boolean in the process method. A redirect will not happen when you make errors on your form. Because that is not possible for a stateless page.
          Hide
          Johan Compagner added a comment -

          stateless forms auto redirect now.
          Also multiply other fixes for the different url coding stategies.

          Show
          Johan Compagner added a comment - stateless forms auto redirect now. Also multiply other fixes for the different url coding stategies.

            People

            • Assignee:
              Johan Compagner
              Reporter:
              Shumbola
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development