You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Christopher Merrill <ch...@webperformance.com> on 2015/05/11 22:44:57 UTC

Google AppEngine Initializer and Wicket 6?

(Is this the right place for this question? Should I raise an issue on
WicketStuff instead?)


Curious to see if anyone is doing this and what your level of success is?

I ask because we have a Wicket/GAE app that we recently moved up to Wicket
6 and we're experiencing a lot of spontaneous problems that are kinda hard
to explain and hard to reproduce.

Examples:
1. Clicking a simple link (sometimes) returns to the same page, rather than
following the link with a very basic implementation such as:
    Link.onClick(): setResponsePage(((BaseApplication)
getApplication()).getSignInPageClass());
When this happens, it happens consistently (i.e. I click the same link and
the same thing happens), but if I reopen the browser, login and try again,
it works fine.
2. Changes applied to the Model<> objects in an AjaxButton.onSubmit()
method have been lost when the page form is submitted.
3. Clicking a form submit button (which was enabled in an
AjaxEventBehavior("onKeyUp").onEvent() method) complains it is not enabled
when it is clicked. It was visually disabled when the page loaded and was
visually enabled with the right things triggered the Ajax behavior
referenced above.

All of these functions in the app that broke have been working for years.

We are using Google AppEngine Initializer from WicketStuff (6.19 with
Wicket 6.19).
I noticed the docs for GAE Initializer now say "Just put
wicketstuff-gae-initializer.jar in the classpath and Wicket will use it
automatically."

I feel like that wasn't the process back when we started using it - we have
some classes that override Wicket operations with WicketStuff GAE classes -
could this be the problem? As an example, we have a GaeWicketApplication
class that extends Application and implements GaeApplication to do things
like change the RuntimeConfigurationType, override the eviction strategy
and return a different IExceptionMapper provider. Should I back out some of
those behaviors to see if the GAE Initializer will handle it all without
any special code?


TIA!
Chris

Re: Google AppEngine Initializer and Wicket 6?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Tue, May 12, 2015 at 6:48 PM, Christopher Merrill <
chris@webperformance.com> wrote:

> Thanks for responding, Martin.
>
> I have found only one error in the AppEngine logs - that was for the #3
> that I mentioned above - there is a Wicket error in the logs that says a
> button is not enabled. It appears when I click the button (which had been
> previously enabled via an Ajax event).
>
> Other than that, I can't find anything in the logs that indicate a problem.
>
>
> We specifically implement GaeApplication on top of our own base Wicket
> application class like this:
>
> public abstract class GaeWicketApplication extends BaseApplication
> implements GaeApplication
>     {
>     public GaeWicketApplication(String application_title_key)
>         {
>         super(application_title_key);
>         _is_production =
>
> "Production".equalsIgnoreCase(System.getProperty("com.google.appengine.runtime.environment"));
>         }
>
>     @Override
>      public RuntimeConfigurationType getConfigurationType()
>          {
>          if (_is_production)
>              return RuntimeConfigurationType.DEPLOYMENT;
>          else
>              return RuntimeConfigurationType.DEVELOPMENT;
>          }
>
>     @Override
>     public IDataStoreEvictionStrategy getEvictionStrategy()
>         {
>         return new MemorySizeEvictionStrategy(Bytes.kilobytes(900));
>         }
>
>     @Override
>     public IProvider<IExceptionMapper> getExceptionMapperProvider()
>         {
>         return new IProvider<IExceptionMapper>()
>             {
>             @Override
>             public IExceptionMapper get()
>                 {
>                 return new ExceptionPageMapper();
>                 }
>             };
>         }
>
>     private boolean _is_production;
>
>
> There is one behavior that I've observed on several occasions: clicking a
> link that was implemented with very simple code, such as:
>   setResponsePage(new OrganizationAdministrationPage(getPageReference(),
> _organization_key)));
> would result in a 302 back to the page that I was already on.
>
> Could that behavior be related to this code in our ExceptionPageMapper:
>
> if (e instanceof StalePageException)
>     {
>     // If the page was stale, just rerender it
>     // (the url should always be updated by an redirect in that case)
>     return new RenderPageRequestHandler(new
> PageProvider(((StalePageException)e).getPage()));
>     }
>
> The above code was an attempt to keep StalePageExceptions from appearing.
>

This is how Wicket handles this exception by default:
https://github.com/apache/wicket/blob/8417af66413c4264a490e69cc20fbc811e861905/wicket-core/src/main/java/org/apache/wicket/DefaultExceptionMapper.java#L127

StalePageException is being thrown when the user tries to use a
link/button/submit a form which old 'renderCount' number in the special
request parameter: ?3-4.IBehaviorListener.3-some-path.
In the example '4' is the renderCount. It is incremented with every page
(re)render:
https://github.com/apache/wicket/blob/8417af66413c4264a490e69cc20fbc811e861905/wicket-core/src/main/java/org/apache/wicket/Page.java#L1017
This often happens if you open the page in several browser tabs/windows,
even when doing 'view-source'.


>
> Thanks for any advice you have :)
> Chris
>
>
>
>
>
> On Tue, May 12, 2015 at 2:18 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > This is the way wicketstuff-gae-initializer works since its day 1.
> > Branch 1.5.x also uses IInitializer:
> >
> >
> https://github.com/wicketstuff/core/blob/7c2a78df17674b3eff9503a8d3afae2fa8622176/jdk-1.5-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties
> > AFAIK there were no changes in this module for a very long time:
> > -
> >
> >
> https://github.com/wicketstuff/core/commits/master/jdk-1.7-parent/gae-initializer-parent
> > -
> >
> >
> https://github.com/wicketstuff/core/commits/wicket-6.x/jdk-1.6-parent/gae-initializer-parent
> >
> > Any errors in the logs?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, May 11, 2015 at 11:44 PM, Christopher Merrill <
> > chris@webperformance.com> wrote:
> >
> > > (Is this the right place for this question? Should I raise an issue on
> > > WicketStuff instead?)
> > >
> > >
> > > Curious to see if anyone is doing this and what your level of success
> is?
> > >
> > > I ask because we have a Wicket/GAE app that we recently moved up to
> > Wicket
> > > 6 and we're experiencing a lot of spontaneous problems that are kinda
> > hard
> > > to explain and hard to reproduce.
> > >
> > > Examples:
> > > 1. Clicking a simple link (sometimes) returns to the same page, rather
> > than
> > > following the link with a very basic implementation such as:
> > >     Link.onClick(): setResponsePage(((BaseApplication)
> > > getApplication()).getSignInPageClass());
> > > When this happens, it happens consistently (i.e. I click the same link
> > and
> > > the same thing happens), but if I reopen the browser, login and try
> > again,
> > > it works fine.
> > > 2. Changes applied to the Model<> objects in an AjaxButton.onSubmit()
> > > method have been lost when the page form is submitted.
> > > 3. Clicking a form submit button (which was enabled in an
> > > AjaxEventBehavior("onKeyUp").onEvent() method) complains it is not
> > enabled
> > > when it is clicked. It was visually disabled when the page loaded and
> was
> > > visually enabled with the right things triggered the Ajax behavior
> > > referenced above.
> > >
> > > All of these functions in the app that broke have been working for
> years.
> > >
> > > We are using Google AppEngine Initializer from WicketStuff (6.19 with
> > > Wicket 6.19).
> > > I noticed the docs for GAE Initializer now say "Just put
> > > wicketstuff-gae-initializer.jar in the classpath and Wicket will use it
> > > automatically."
> > >
> > > I feel like that wasn't the process back when we started using it - we
> > have
> > > some classes that override Wicket operations with WicketStuff GAE
> > classes -
> > > could this be the problem? As an example, we have a
> GaeWicketApplication
> > > class that extends Application and implements GaeApplication to do
> things
> > > like change the RuntimeConfigurationType, override the eviction
> strategy
> > > and return a different IExceptionMapper provider. Should I back out
> some
> > of
> > > those behaviors to see if the GAE Initializer will handle it all
> without
> > > any special code?
> > >
> > >
> > > TIA!
> > > Chris
> > >
> >
>

Re: Google AppEngine Initializer and Wicket 6?

Posted by Christopher Merrill <ch...@webperformance.com>.
Thanks for responding, Martin.

I have found only one error in the AppEngine logs - that was for the #3
that I mentioned above - there is a Wicket error in the logs that says a
button is not enabled. It appears when I click the button (which had been
previously enabled via an Ajax event).

Other than that, I can't find anything in the logs that indicate a problem.


We specifically implement GaeApplication on top of our own base Wicket
application class like this:

public abstract class GaeWicketApplication extends BaseApplication
implements GaeApplication
    {
    public GaeWicketApplication(String application_title_key)
        {
        super(application_title_key);
        _is_production =
"Production".equalsIgnoreCase(System.getProperty("com.google.appengine.runtime.environment"));
        }

    @Override
     public RuntimeConfigurationType getConfigurationType()
         {
         if (_is_production)
             return RuntimeConfigurationType.DEPLOYMENT;
         else
             return RuntimeConfigurationType.DEVELOPMENT;
         }

    @Override
    public IDataStoreEvictionStrategy getEvictionStrategy()
        {
        return new MemorySizeEvictionStrategy(Bytes.kilobytes(900));
        }

    @Override
    public IProvider<IExceptionMapper> getExceptionMapperProvider()
        {
        return new IProvider<IExceptionMapper>()
            {
            @Override
            public IExceptionMapper get()
                {
                return new ExceptionPageMapper();
                }
            };
        }

    private boolean _is_production;


There is one behavior that I've observed on several occasions: clicking a
link that was implemented with very simple code, such as:
  setResponsePage(new OrganizationAdministrationPage(getPageReference(),
_organization_key)));
would result in a 302 back to the page that I was already on.

Could that behavior be related to this code in our ExceptionPageMapper:

if (e instanceof StalePageException)
    {
    // If the page was stale, just rerender it
    // (the url should always be updated by an redirect in that case)
    return new RenderPageRequestHandler(new
PageProvider(((StalePageException)e).getPage()));
    }

The above code was an attempt to keep StalePageExceptions from appearing.

Thanks for any advice you have :)
Chris





On Tue, May 12, 2015 at 2:18 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> This is the way wicketstuff-gae-initializer works since its day 1.
> Branch 1.5.x also uses IInitializer:
>
> https://github.com/wicketstuff/core/blob/7c2a78df17674b3eff9503a8d3afae2fa8622176/jdk-1.5-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties
> AFAIK there were no changes in this module for a very long time:
> -
>
> https://github.com/wicketstuff/core/commits/master/jdk-1.7-parent/gae-initializer-parent
> -
>
> https://github.com/wicketstuff/core/commits/wicket-6.x/jdk-1.6-parent/gae-initializer-parent
>
> Any errors in the logs?
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, May 11, 2015 at 11:44 PM, Christopher Merrill <
> chris@webperformance.com> wrote:
>
> > (Is this the right place for this question? Should I raise an issue on
> > WicketStuff instead?)
> >
> >
> > Curious to see if anyone is doing this and what your level of success is?
> >
> > I ask because we have a Wicket/GAE app that we recently moved up to
> Wicket
> > 6 and we're experiencing a lot of spontaneous problems that are kinda
> hard
> > to explain and hard to reproduce.
> >
> > Examples:
> > 1. Clicking a simple link (sometimes) returns to the same page, rather
> than
> > following the link with a very basic implementation such as:
> >     Link.onClick(): setResponsePage(((BaseApplication)
> > getApplication()).getSignInPageClass());
> > When this happens, it happens consistently (i.e. I click the same link
> and
> > the same thing happens), but if I reopen the browser, login and try
> again,
> > it works fine.
> > 2. Changes applied to the Model<> objects in an AjaxButton.onSubmit()
> > method have been lost when the page form is submitted.
> > 3. Clicking a form submit button (which was enabled in an
> > AjaxEventBehavior("onKeyUp").onEvent() method) complains it is not
> enabled
> > when it is clicked. It was visually disabled when the page loaded and was
> > visually enabled with the right things triggered the Ajax behavior
> > referenced above.
> >
> > All of these functions in the app that broke have been working for years.
> >
> > We are using Google AppEngine Initializer from WicketStuff (6.19 with
> > Wicket 6.19).
> > I noticed the docs for GAE Initializer now say "Just put
> > wicketstuff-gae-initializer.jar in the classpath and Wicket will use it
> > automatically."
> >
> > I feel like that wasn't the process back when we started using it - we
> have
> > some classes that override Wicket operations with WicketStuff GAE
> classes -
> > could this be the problem? As an example, we have a GaeWicketApplication
> > class that extends Application and implements GaeApplication to do things
> > like change the RuntimeConfigurationType, override the eviction strategy
> > and return a different IExceptionMapper provider. Should I back out some
> of
> > those behaviors to see if the GAE Initializer will handle it all without
> > any special code?
> >
> >
> > TIA!
> > Chris
> >
>

Re: Google AppEngine Initializer and Wicket 6?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This is the way wicketstuff-gae-initializer works since its day 1.
Branch 1.5.x also uses IInitializer:
https://github.com/wicketstuff/core/blob/7c2a78df17674b3eff9503a8d3afae2fa8622176/jdk-1.5-parent/gae-initializer-parent/gae-initializer/src/main/resources/wicket.properties
AFAIK there were no changes in this module for a very long time:
-
https://github.com/wicketstuff/core/commits/master/jdk-1.7-parent/gae-initializer-parent
-
https://github.com/wicketstuff/core/commits/wicket-6.x/jdk-1.6-parent/gae-initializer-parent

Any errors in the logs?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 11, 2015 at 11:44 PM, Christopher Merrill <
chris@webperformance.com> wrote:

> (Is this the right place for this question? Should I raise an issue on
> WicketStuff instead?)
>
>
> Curious to see if anyone is doing this and what your level of success is?
>
> I ask because we have a Wicket/GAE app that we recently moved up to Wicket
> 6 and we're experiencing a lot of spontaneous problems that are kinda hard
> to explain and hard to reproduce.
>
> Examples:
> 1. Clicking a simple link (sometimes) returns to the same page, rather than
> following the link with a very basic implementation such as:
>     Link.onClick(): setResponsePage(((BaseApplication)
> getApplication()).getSignInPageClass());
> When this happens, it happens consistently (i.e. I click the same link and
> the same thing happens), but if I reopen the browser, login and try again,
> it works fine.
> 2. Changes applied to the Model<> objects in an AjaxButton.onSubmit()
> method have been lost when the page form is submitted.
> 3. Clicking a form submit button (which was enabled in an
> AjaxEventBehavior("onKeyUp").onEvent() method) complains it is not enabled
> when it is clicked. It was visually disabled when the page loaded and was
> visually enabled with the right things triggered the Ajax behavior
> referenced above.
>
> All of these functions in the app that broke have been working for years.
>
> We are using Google AppEngine Initializer from WicketStuff (6.19 with
> Wicket 6.19).
> I noticed the docs for GAE Initializer now say "Just put
> wicketstuff-gae-initializer.jar in the classpath and Wicket will use it
> automatically."
>
> I feel like that wasn't the process back when we started using it - we have
> some classes that override Wicket operations with WicketStuff GAE classes -
> could this be the problem? As an example, we have a GaeWicketApplication
> class that extends Application and implements GaeApplication to do things
> like change the RuntimeConfigurationType, override the eviction strategy
> and return a different IExceptionMapper provider. Should I back out some of
> those behaviors to see if the GAE Initializer will handle it all without
> any special code?
>
>
> TIA!
> Chris
>