Well, I'm still unable to spot anything strange.  No matter what page I
annotate, it doesn't switch to https until the form is submitted.  It then
goes to https (as if it's redirecting to itself?) and triggers the
validation on the page, even if the correct fields are filled in.  No matter
what page I annotate on this site, it happens the same way.

Here's an example from this app:

The "login or create a new account page":

@RequireHttps
public class UserAccount extends BasePage
{
    public UserAccount()
    {
        //get user from session
        User user = ((UserSession)getSession()).getUser();

        //pass go, collect $200
        if (user != null)
            throw new RestartResponseException(new ContactInfo());

        add(new FeedbackPanel("feedbackPanel"));

        //get cart in session
        ShoppingCartLocal cart = ((UserSession)getSession()).getCart();

    //entities
    Order order = cart.getOrder();
    Customer customer = order.getCustomer();
    String email = (order != null && customer != null) ? customer.getEmail()
: "";

        //form model (entity)
        if (user == null) user = new User();

        //if email exists, pre-populate form
    if (email != null && !email.equals(""))
            user.setUsername(email);

    final Form returnUserForm = new Form("retUserAccountForm", new
CompoundPropertyModel(user));
    final Form newUserForm = new Form("newUserAccountForm", new
CompoundPropertyModel(user));

    //add form components
    returnUserForm.add(new TextField("username")
        .setRequired(true)
        .add(EmailAddressPatternValidator.getInstance()));
    returnUserForm.add(new PasswordTextField("password"));

    returnUserForm.add(new Button("userAcctButton")
    {
      public void onSubmit()
      {
        ShoppingCartLocal  cart = null;

        try
        {
          //save form values, redirect
          User user = (User)returnUserForm.getModelObject();

          //get cart from session
          cart = ((UserSession)getSession()).getCart();

          //create order in session
          cart = CartProxy.authUserAccount(cart, user);

          //set cart back to session & log user in
          ((UserSession)getSession()).setCart(cart);
          ((UserSession)getSession()).setUser(
              cart.getOrder().getCustomer().getUser());

          //redirect
          setResponsePage(new ContactInfo());
        }
        catch (Exception exp)
        {
          info(exp.getMessage());
          LogProxy.saveEntry(exp);
        }
      }
    });

    returnUserForm.add(new Link("forgotPasswordLink")
    {
      public void onClick()
      {
        setResponsePage(new ForgotPassword());
      }
    });


    //add form components
    newUserForm.add(new TextField("username")
        .setRequired(true)
        .add(EmailAddressPatternValidator.getInstance()));

    newUserForm.add(new Button("userAcctButton")
    {
      public void onSubmit()
      {
        ShoppingCartLocal  cart = null;

        try
        {
          //save form values, redirect
          User user = (User)newUserForm.getModelObject();

          //get cart from session
          cart = ((UserSession)getSession()).getCart();

          //create order in session
          cart = CartProxy.createUserAccount(cart, user);

          //set cart back to session & log user in
          ((UserSession)getSession()).setCart(cart);
          ((UserSession)getSession()).setUser(
              cart.getOrder().getCustomer().getUser());

          //redirect
          setResponsePage(new ContactInfo());
        }
        catch (Exception exp)
        {
          info(exp.getMessage());
          LogProxy.saveEntry(exp);
        }
      }
    });

    //add forms
    add(returnUserForm);
    add(newUserForm);
    }
}

...the "BasePage" class:

public abstract class BasePage extends WebPage
{
  private String pageTitle = "My page title!";

  public BasePage()
  {
    //add page title
    add(new Label("title", new PropertyModel(this, "pageTitle")));

    //add page components
    add(new TrailPanel("trailPanel",
      TrailFactory.getUserPageTrail(this.getPageClass().getSimpleName())));
    add(new HeaderPanel("headerPanel"));
    add(new FooterPanel("footerPanel"));
  }

  public final String getPageTitle()
  {
    return pageTitle;
  }

  public final void setPageTitle(String title)
  {
    this.pageTitle = title;
  }

  protected void redirect(String url)
  {
    //disable wicket redirecting
    getRequestCycle().setRedirect(false);

    //make sure no output for the current cycle is sent
    getRequestCycle().setRequestTarget(EmptyRequestTarget.getInstance());

    //set absolute URL to redirect to
    getResponse().redirect(url);
  }
}

...just in case, the application class:

public class ProductCatalogApp extends WebApplication
{
  /**
   * initialize application resources
   */
  @Override
  public void init()
  {
    //mount pretty URLs
    mountURLs();

    //create external images resource
    getSharedResources().add("imageResource", new ImageResource());

    //start timer services
    TimerProxy.init();
  }

  /**
   * set application home page
   */
  public Class getHomePage()
  {
    return ProductCatalog.class;
  }

  /**
   * set custom session class
   */
  @Override
  public Session newSession(Request request, Response response)
  {
    return new UserSession(ProductCatalogApp.this, request);
  }

  @Override
  protected IRequestCycleProcessor newRequestCycleProcessor()
  {
    return new HttpsRequestCycleProcessor(new HttpsConfig(8080, 8181));
  }

  /**
   * Simple method for listing bookmarked pages with "pretty" URLs
   *
   */
  private void mountURLs()
  {
    mount(new HybridUrlCodingStrategy("/login", Login.class));
    mount(new HybridUrlCodingStrategy("/products", ProductCatalog.class));
    mount(new HybridUrlCodingStrategy("/category", CatalogCategory.class));
    mount(new HybridUrlCodingStrategy("/product-detail",
ProductDetail.class));
    mount(new HybridUrlCodingStrategy("/cart", Cart.class));
    mount(new HybridUrlCodingStrategy("/account", UserAccount.class));
    mount(new HybridUrlCodingStrategy("/addresses", ContactInfo.class));
    mount(new HybridUrlCodingStrategy("/payment", PaymentInfo.class));
  }
}

Hopefully something stands out to someone here...I don't see what could be
causing it?

Thanks again,

-v

On Sun, Dec 20, 2009 at 9:29 PM, <b...@actrix.gen.nz> wrote:

> Hi VGJ,
>
> If, as you say you can reproduce this in your storefront app no matter
> where you use it then you may want to reduce this to a testcase and
> create a jira issue from it.
>
> You are already writing that you can reproduce it and consequently it
> would be only a matter of removing all distracting detail from your
> storefront until further simplification is no longer possible. I can't
> see how otherwise anyone could help you with your issue.
>
> In any case, glitches like you mention should not happen whether the
> problem is in the Wicket framework domain or in the application
> domain. If it is in the application domain, as it would usually be the
> case because Wicket is mature, then there would still be a benefit of
> publishing the issue e.g. in a Wiki article so that others would not
> make the same mistake.
>
> Good luck!
>
> Bernard
>
> On Fri, 18 Dec 2009 14:58:15 -0700, you wrote:
>
> >I was unable to re-create it in a simple web app w/ a few pages.  However,
> >no matter where I use it in my storefront app, it happens.
> >
> >It's very strange because it starts a page "late".  I put the annotation
> on
> >the User Account page, yet it doesn't switch to https until I reach the
> >*following* page in the checkout process.  I just stuck it on the general
> >Login page that exists outside of the checkout process...and when I click
> >the link from the home page to go to the Login page using
> >setResponsePage(new Login()), it doesn't switch to https.  Instead, I
> enter
> >the user/pass and submit...THEN it goes to https, then I'm able to
> re-enter
> >and login.
> >
> >Very strange behavior...I have no idea what might be causing it.
> >
> >I use various Panels throughout the side, would that have any influence on
> >it?  For example, the link in the header to go to the Login page is inside
> >of a straightforward Panel.  The entire site uses markup inheritance as
> >well.
> >
> >On Fri, Dec 18, 2009 at 9:29 AM, VGJ <zambi...@gmail.com> wrote:
> >
> >> I'll create one and post it, if I can.
> >>
> >> -v
> >>
> >>
> >> On Fri, Dec 18, 2009 at 9:21 AM, Igor Vaynberg <igor.vaynb...@gmail.com
> >wrote:
> >>
> >>> can you recreate in a quickstart?
> >>>
> >>> -igor
> >>>
> >>> On Fri, Dec 18, 2009 at 7:56 AM, VGJ <zambi...@gmail.com> wrote:
> >>> > I'm now using @RequireHttps to switch to https on certain pages but
> it's
> >>> not
> >>> > quite working right.
> >>> >
> >>> > In our storefront app, I'm switching to https at the point in the
> >>> checkout
> >>> > process where you view your cart, and then proceed to a page to
> either
> >>> login
> >>> > or create an account.  When I submit my username and password, the
> >>> > validation fires as if I entered nothing into the form.  Enter it a
> >>> second
> >>> > time and it works - the validation doesn't trigger.  Everything was
> >>> entered
> >>> > correctly the first time around...so it's as if the form is being
> posted
> >>> on
> >>> > its own, when the page loads?  Every page with @RequireHttps that has
> a
> >>> > form, does this.
> >>> >
> >>> > What do I need to do to change to accommodate validation under
> >>> @RequireHttps
> >>> > pages?
> >>> >
> >>> > Currently you just see a lot of forms w/ fields like this:
> >>> >
> >>> > add(new TextField("username").setRequired(true));
> >>> >
> >>> > ...with a pretty common feedback panel:
> >>> >
> >>> >            <div id="feedbackPanel">
> >>> >              <span wicket:id="feedbackPanel" class="warning" />
> >>> >            </div>
> >>> >
> >>> > Thanks!
> >>> >
> >>> > -v
> >>> >
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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