Errata: this is not the code which is used to make request, but to call js.

Request are simple GETs or POSTs sometimes with attached files, they talk with 
servlet.
When requests are done, js is called from applet with success, but for some 
reason I get StalePageException in the request listener if in the final stage 
of applet thread three requests are done. When applet makes only one request in 
the final stage, everything is fine.

Simplest example of request which is used:

                URL url = new URL(getDocumentBase(), spec);

                HttpGet get = new HttpGet(url.toURI());
                get.addHeader("Cookie", getCookie());

                HttpResponse response = client.execute(get);
                
                String responseText = EntityUtils.toString( 
response.getEntity() );

Best regards,
Michal Wegrzyn

> -----Original Message-----
> From: Martin Grigorov [mailto:mgrigo...@apache.org]
> Sent: Monday, November 26, 2012 16:57
> To: users@wicket.apache.org
> Subject: Re: multiple requests and StalePageException
> 
> The problem is clear.
> 
> 
> On Mon, Nov 26, 2012 at 4:54 PM, Michal Wegrzyn
> <michal.wegr...@onior.com>wrote:
> 
> >         private JSObject window;
> >
> >         public void documentUpdated( String newDocumentId ) {
> >
> >                 window.call( "documentUpdated", new String[] {
> param1,
> > param2 } );
> >         }
> >
> > > -----Original Message-----
> > > From: Martin Grigorov [mailto:mgrigo...@apache.org]
> > > Sent: Monday, November 26, 2012 16:51
> > > To: users@wicket.apache.org
> > > Subject: Re: multiple requests and StalePageException
> > >
> > > Can you show the code that the applet uses to make requests to the
> > > page ?
> > >
> > >
> > > On Mon, Nov 26, 2012 at 4:47 PM, Michal Wegrzyn
> > > <michal.wegr...@onior.com>wrote:
> > >
> > > > Hi Martin,
> > > >
> > > > Thanks for a tip. What do you mean by "uses Wicket.Ajax.**"?
> > > >
> > > > Applet till now generated fake event to trigger Wicket ajax
> behavior.
> > > >
> > > > I have just tried calling behavior directly with wicketAjaxGet (
> > > > https://cwiki.apache.org/WICKET/calling-wicket-from-
> javascript.htm
> > > > l)
> > > > but I get the same result.
> > > >
> > > > Best regards,
> > > > Michal Wegrzyn
> > > >
> > > > > -----Original Message-----
> > > > > From: Martin Grigorov [mailto:mgrigo...@apache.org]
> > > > > Sent: Monday, November 26, 2012 14:03
> > > > > To: users@wicket.apache.org
> > > > > Subject: Re: multiple requests and StalePageException
> > > > >
> > > > > The renderCount increases only when you use non-Ajax requests,
> i.e.
> > > > > when you re-render the whole page.
> > > > > Make sure that "executes Wicket behavior via js" uses
> > > Wicket.Ajax.**
> > > > >
> > > > >
> > > > > On Mon, Nov 26, 2012 at 1:56 PM, Michal Wegrzyn
> > > > > <michal.wegr...@onior.com>wrote:
> > > > >
> > > > > > Hi group,
> > > > > >
> > > > > > In my Wicket application I have an applet. In the background
> > > > > > it requests servlet and finally executes Wicket behavior via
> js.
> > > > > > If one request is performed, then everything works without
> > > problems.
> > > > > >
> > > > > > Lately I have changed applet and now it can do one or three
> > > requests.
> > > > > > If it performs three requests then StalePageException is
> > > > > > thrown,
> > > > > which
> > > > > > causes page refreshed and that is not a desired behavior.
> > > > > > When I debug difference between render counter and page
> > > > > > counter
> > > is
> > > > > > exactly 2, so I think that issue is connected with two
> "extra"
> > > > > > applet
> > > > > requests.
> > > > > >
> > > > > > Do I miss something on the Wicket side? If not, what is the
> > > > > > best way to avoid StalePageException in this case?
> > > > > >
> > > > > > Best regards,
> > > > > > Michal Wegrzyn
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Martin Grigorov
> > > > > jWeekend
> > > > > Training, Consulting, Development http://jWeekend.com
> > > > > <http://jweekend.com/>
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > jWeekend
> > > Training, Consulting, Development
> > > http://jWeekend.com <http://jweekend.com/>
> >
> 
> 
> 
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>

Reply via email to