RE: multiple requests and StalePageException
Problem comes from 3rd party library that does some extra actions along applet's 3 requests. Library actions trigger extra GET requests for a whole page ( for example http://server/app/?2 ), Which are the reason of StalePageException during calling javascript from applet. I must still debug to see what really triggers these GETs. Thanks for the help Martin. 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.comwrote: 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/
RE: multiple requests and StalePageException
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.comwrote: 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.comwrote: 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.comwrote: 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/
RE: multiple requests and StalePageException
I have just debugged to make it sure. Decision to refresh page is done in org.apache.wicket.request.handler.PageProvider.getStoredPage(int pageId): IRequestablePage storedPageInstance = getPageSource().getPageInstance(pageId); if (storedPageInstance != null) { if (pageClass == null || pageClass.equals(storedPageInstance.getClass())) { pageInstance = storedPageInstance; pageInstanceIsFresh = false; if (renderCount != null pageInstance.getRenderCount() != renderCount) { throw new StalePageException(pageInstance); } } else { // the found page class doesn't match the requested one storedPageInstance = null; } } return storedPageInstance; If applet makes in the final stage one request, then render count from both PageAndComponentProvider and pageInstance are equal (for example 1). If applet makes in the final stage three requests, then render count from PageAndComponentProvider is 1 but render count from pageInstance is 3. Best regards, Michal Wegrzyn -Original Message- From: Michal Wegrzyn [mailto:michal.wegr...@onior.com] Sent: Tuesday, November 27, 2012 9:50 To: users@wicket.apache.org Subject: RE: multiple requests and StalePageException 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.comwrote: 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.comwrote: 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.comwrote: 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
multiple requests and StalePageException
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
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.comwrote: 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/
RE: multiple requests and StalePageException
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.html) 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.comwrote: 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/
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.comwrote: 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.html) 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.comwrote: 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/
RE: multiple requests and StalePageException
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.comwrote: 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.html) 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.comwrote: 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/
Re: multiple requests and StalePageException
The problem is clear. On Mon, Nov 26, 2012 at 4:54 PM, Michal Wegrzyn michal.wegr...@onior.comwrote: 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.comwrote: 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.html) 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.comwrote: 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/