Hi Martin, DefaultPageStore#storePage(SerializedPage page) is holding only 40 pages in cache and removes others. It seems pageSotre appending every new versions and deleting old one. Like, cache.remove(0).
I'm keeping my page in session and trying to fetch from session . But wicket looking into the PageStore not in the session. why it is not checking in session? Can I directly store a page by calling the DefaultPageStore#storePage(SerializedPage page) in a page to refresh the page version in pageStore? Ex: DefaultPageStore#storePage(this) Following code works for me, but I don't know whether this is the right solution for the issue. IDataStore dataStore=new HttpSessionDataStore(pageManagerContext,new PageNumberEvictionStrategy(500)); Any Help? On Thu, Sep 8, 2016 at 3:12 PM, Martin Grigorov <[email protected]> wrote: > Hi, > > > On Thu, Sep 8, 2016 at 8:38 PM, durairaj t <[email protected]> wrote: > > > I have added the below code in my WebApp.java to keep the pages in > session > > alive. Is it correct? Any help? > > > > setPageManagerProvider(new DefaultPageManagerProvider(this) > > { > > protected IDataStore newDataStore() > > { > > //new HttpSessionDataStore(getPageManagerContext(), new > > MemorySizeEvictionStrategy (null ) ) > > > According to the code "MemorySizeEvictionStrategy(null)" should throw > IllegalArgumentException. The size (maxBytes) could not be null! > > > > ; > > return new HttpSessionDataStore(getPageManagerContext(), new > > PageNumberEvictionStrategy(1000000000)); > > > > This is very big number! > You could easily run your web server out of memory! > Consider more sane value! > > > The reasons for PageExpiredException are listed in its javadoc. > I'd bet the first one is the real reason - the page has never been stored > due to some problem, e.g. NotSerializableException. > Put a breakpoint > at org.apache.wicket.pageStore.memory.HttpSessionDataStore#storeData() and > make sure the page is being stored. > Ajax requests *override* existing entries in the page store. So the store > size doesn't change much. > > > > } > > }); > > > > > > > > > > > > > > On Thu, Sep 8, 2016 at 9:20 AM, durairaj t <[email protected]> > wrote: > > > > > Hi Martin, > > > > > > I got the exact error message while debugging in eclipse; > > > > > > *Error*: " org.apache.wicket.protocol.http.PageExpiredException: Page > > > with id '3' has expired." > > > > > > > > > I tried following code snippet in the page constructor. It seems the > > > following code updating the page until I'm moving out from the current > > > (search modal window) page. > > > > > > *Solun 1:* > > > > > > moduleForm.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(1)){ > > > //one second > > > > > > private static final long serialVersionUID = 1L; > > > @Override > > > protected void onPostProcessTarget(AjaxRequestTarget target) { > > > // TODO Auto-generated method stub > > > super.onPostProcessTarget(target); > > > System.out.println(" i'm alive...."); > > > } > > > }); > > > > > > *Solun 2:* > > > moduleForm.add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) { > > > //one second > > > protected void onTimer(final AjaxRequestTarget target) { > > > System.out.println(" i'm alive...."); > > > } > > > }); > > > > > > > > > How to extend the page life time? > > > > > > > > > On Wed, Aug 31, 2016 at 3:29 PM, durairaj t <[email protected]> > > > wrote: > > > > > >> Thank you martin! Let me try this. > > >> > > >> > > >> > > >> > > >> On Wed, Aug 31, 2016 at 2:27 PM, Martin Grigorov < > [email protected]> > > >> wrote: > > >> > > >>> Hi, > > >>> > > >>> Put a breakpoint at RequestCycle#setResponsePage(Class, > > PageParameters) > > >>> and > > >>> see who and why is calling it. This will tell you the reason. > > >>> If this doesn't help then put breakpoints in > > >>> RestartReponseAtInterceptPageException constructors. > > >>> > > >>> Martin Grigorov > > >>> Wicket Training and Consulting > > >>> https://twitter.com/mtgrigorov > > >>> > > >>> On Wed, Aug 31, 2016 at 5:06 PM, durairaj t <[email protected]> > > >>> wrote: > > >>> > > >>> > I got the same issue in Wicket 1.5, so I migrated it to 6.23, but > > >>> still it > > >>> > is happening. > > >>> > > > >>> > Moreover, I used "*Session.get().replaceSession()**;*" just to > > >>> reproduce > > >>> > the issue. it will not be in the actual application code. > > >>> > > > >>> > and I just used "* WebSession.get().clear(); *, > > >>> *Session.get().clear(); , * > > >>> > *WebSession.get().**replaceSession()*" to reproduce the issue. > they > > >>> are > > >>> > also loading login page as it is happening in the application. > > >>> > > > >>> > I don't know the exact code or component or reason for this issue. > > >>> > > > >>> > > > >>> > On Wed, Aug 31, 2016 at 10:51 AM, Francois Meillet < > > >>> > [email protected]> wrote: > > >>> > > > >>> > > Javadoc from Session # replaceSession() says : Call() upon login > to > > >>> > > protect against session fixation. > > >>> > > > > >>> > > Until Wicket version 6.21 the destroy method did not set the > > session > > >>> id > > >>> > to > > >>> > > null. > > >>> > > In 6.23, Session # destroy() set session#id to null, this is why > > >>> Login > > >>> > > Page is loaded. > > >>> > > > > >>> > > Hope this helps > > >>> > > > > >>> > > François > > >>> > > > > >>> > > > > >>> > > > > >>> > > > Le 31 août 2016 à 16:21, durairaj t <[email protected]> a > > >>> écrit : > > >>> > > > > > >>> > > > Thank you for your quick response. > > >>> > > > > > >>> > > > *Session:* 30 minutes. > > >>> > > > > > >>> > > > *Html Header:* > > >>> > > > > > >>> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > " > > >>> > > > http://www.w3.org/TR/html4/loose.dtd"> > > >>> > > > <html xmlns:wicket="http://wicket.apache.org"> > > >>> > > > > > >>> > > > <head> > > >>> > > > <link rel="SHORTCUT ICON" href="images/favicon.ico" > > >>> type="image/ico" > > >>> > > /> > > >>> > > > > > >>> > > > <meta http-equiv="Page-Enter" content="blendTrans(Duration= > > 0)"> > > >>> > > > <meta http-equiv="Page-Exit" content="blendTrans(Duration= > > 0)"> > > >>> > > > > > >>> > > > <title> > > >>> > > > <wicket:message key="appname" /> - > > >>> > > > <div wicket:id="titlelable"> </div> - > > >>> > > > <wicket:message key="pagename" /> > > >>> > > > </title> > > >>> > > > <link rel="stylesheet" type="text/css" > > href="theme/Master.css"> > > >>> > > > <link rel="stylesheet" type="text/css" > > >>> > href="theme/pageBlocking.css"> > > >>> > > > <link type="text/css" rel="stylesheet" > > >>> > href="Calendar/css/jscal2.css" > > >>> > > /> > > >>> > > > <link type="text/css" rel="stylesheet" > > >>> > > > href="Calendar/css/border-radius.css" /> > > >>> > > > <link id="skin-steel" title="Gold" type="text/css" > > >>> rel="stylesheet" > > >>> > > > href="Calendar/css/steel/steel.css" /> > > >>> > > > <script src="Calendar/js/jscal2.js"></script> > > >>> > > > <script src="Calendar/js/lang/en.js"></script> > > >>> > > > > > >>> > > > <script type="text/javascript" > > >>> > > > src="javascripts/pageBlocking.js"></script> > > >>> > > > <script type="text/javascript" > > >>> > > > src="javascripts/aim-hrs-autocomplete.js"></script> > > >>> > > > <script type="text/javascript" > src="javascripts/aim_util.js"> > > >>> > > </script> > > >>> > > > <script type="text/javascript" > src="javascripts/mvl.js"></scr > > >>> ipt> > > >>> > > > <script type="text/javascript" > src="javascripts/masks.js"></s > > >>> cript> > > >>> > > > <script type="text/javascript" > src="javascripts/yetii.js"></s > > >>> cript> > > >>> > > > <script language="JavaScript" > > >>> > > > src="jspspellcheck/spellcheck-caller.js"></script> > > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > <script language="javascript" type="text/javascript"> > > >>> > > > //credit: http://psacake.com/web/js.asp > > >>> > > > function imposeMaxLength(Object, evt, MaxLen) { > > >>> > > > var e = window.event ? event.keyCode : evt.which > > >>> > > > if (e == 8 || e == 46 || (e >= 37 && e <= 40)) > return > > >>> true; > > >>> > > > //bs, del, arrows > > >>> > > > return (Object.value.length <= MaxLen); > > >>> > > > } > > >>> > > > </script> > > >>> > > > > > >>> > > > <!-- > > >>> > > > <style type="text/css"> > > >>> > > > input:focus,textarea:focus { > > >>> > > > background-color: lightyellow; > > >>> > > > } > > >>> > > > </style> > > >>> > > > --> > > >>> > > > > > >>> > > > <style> > > >>> > > > div.wicket-aa { > > >>> > > > font-family: sans-serif; > > >>> > > > font-size: 12px; > > >>> > > > background-color: white; > > >>> > > > border-width: 2px; > > >>> > > > border-color: gray; > > >>> > > > border-style: solid; > > >>> > > > padding: 2px; > > >>> > > > margin: 1px 0 0 0; > > >>> > > > text-align: left; > > >>> > > > width: 120px; > > >>> > > > } > > >>> > > > > > >>> > > > div.wicket-aa ul { > > >>> > > > list-style: none; > > >>> > > > padding: 2px; > > >>> > > > margin: 0; > > >>> > > > width: 100px; > > >>> > > > } > > >>> > > > > > >>> > > > div.wicket-aa ul li.selected { > > >>> > > > background-color: #DEEFF7; > > >>> > > > padding: 2px; > > >>> > > > margin: 0; > > >>> > > > width: 100px; > > >>> > > > } > > >>> > > > > > >>> > > > div.imxt-vista tr.imxt-grid-row:hover td.imxt-cell, > > >>> > > > div.imxt-vista tr.imxt-grid-row:hover td.imxt-sorted {} > > >>> > > > </style> > > >>> > > > > > >>> > > > > > >>> > > > </head> > > >>> > > > > > >>> > > > > > >>> > > > *Java Code:* > > >>> > > > > > >>> > > > > > >>> > > > > > >>> > > > String timeout= "1750000"; > > >>> > > > if(AppSession.getObjAimShell() != null && > > >>> > > > AppSession.getObjAimShell().getTimeoutLimit() !=null) > > >>> > > > timeout = "" + ((AppSession.getObjAimShell().getTimeoutLimit() > * > > >>> > > 0.9)*1000); > > >>> > > > final Model<String> sessionTimeoutInterval = new > > >>> > Model<String>(timeout); > > >>> > > > HiddenField sessionTimeoutIntervalField = new > > >>> > > > HiddenField("sessionTimeoutInterval", sessionTimeoutInterval) > ; > > >>> > > > sessionTimeoutIntervalField.setOutputMarkupId(true); > > >>> > > > sessionTimeoutIntervalField.setMarkupId(" > > sessionTimeoutInterval"); > > >>> > > > add(sessionTimeoutIntervalField); > > >>> > > > > > >>> > > > > > >>> > > > *Java Script:* > > >>> > > > var sessionPingTime = 1750000; > > >>> > > > var sessionTimerId = null; > > >>> > > > > > >>> > > > function resetSessionTimer() { > > >>> > > > try{ > > >>> > > > if(document.getElementById('sessionTimeoutInterval')) { > > >>> > > > sessionPingTime = document.getElementById('sessi > > >>> onTimeoutInterval'). > > >>> > > value; > > >>> > > > } > > >>> > > > if(parent) { > > >>> > > > parent.clearTimeout(parent.sessionTimerId); > > >>> > > > parent.sessionTimerId = null; > > >>> > > > parent.sessionTimerId = parent.setTimeout(" > > windowCloseSignOff();", > > >>> > > > sessionPingTime); > > >>> > > > }else { > > >>> > > > clearTimeout(parent.sessionTimerId); > > >>> > > > sessionTimerId = null; > > >>> > > > sessionTimerId = setTimeout("windowCloseSignOff();", > > >>> sessionPingTime); > > >>> > > > } > > >>> > > > }catch(c){showScriptError(c, 'resetSessionTimer');} > > >>> > > > } > > >>> > > > > > >>> > > > > > >>> > > > On Wed, Aug 31, 2016 at 10:05 AM, Francois Meillet < > > >>> > > > [email protected]> wrote: > > >>> > > > > > >>> > > >> Hi, > > >>> > > >> > > >>> > > >> What is the session-timeout ? > > >>> > > >> Can you show the html page header ? and any java code that > > modify > > >>> it. > > >>> > > >> > > >>> > > >> François > > >>> > > >> > > >>> > > >> > > >>> > > >> > > >>> > > >>> Le 31 août 2016 à 15:49, durairaj t <[email protected]> > a > > >>> > écrit : > > >>> > > >>> > > >>> > > >>> I'm migrating to wicket 6.23, createPage() is working as > > >>> expected in > > >>> > > >> many > > >>> > > >>> modules, but not in the below scenario. > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> There is a search modal window in the application, which is > > used > > >>> to > > >>> > > >> search > > >>> > > >>> data and keep the entire Page in session to retrieve the data > > >>> back > > >>> > from > > >>> > > >> the > > >>> > > >>> session (for the Back button functionality). > > >>> > > >>> > > >>> > > >>> *Issue:* > > >>> > > >>> > > >>> > > >>> The search window is just working for 10 to 15 minutes as > > >>> expected > > >>> > and > > >>> > > >> then > > >>> > > >>> loading Login Page suddenly. > > >>> > > >>> > > >>> > > >>> In debug: (I verified the below in the eclipse debugging > mode) > > >>> > > >>> > > >>> > > >>> 1. Returning page from session > > >>> > > >>> 2. Page from session is *NOT *null. > > >>> > > >>> 3. Session ID is *NOT *modified anywhere in the application. > > >>> > > >>> 4. It is just happening only in the search window until I'm > > >>> clearing > > >>> > > the > > >>> > > >>> Search Page object (SrcPage) . But application is not asking > me > > >>> to > > >>> > > >> re-login > > >>> > > >>> once it happened. > > >>> > > >>> > > >>> > > >>> *Code snippet:* > > >>> > > >>> > > >>> > > >>> public Page createPage() { > > >>> > > >>> return AppSession.getObjAppShell().getSrcPage(); > > >>> > > >>> }); > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> *Reproducing Issue:* > > >>> > > >>> > > >>> > > >>> I can reproduce the issue by replacing the session in the > > >>> > createPage() > > >>> > > >>> block, but I'm not sure whether the problem is session or > > >>> something > > >>> > > else. > > >>> > > >>> > > >>> > > >>> Example; > > >>> > > >>> > > >>> > > >>> public Page createPage() { > > >>> > > >>> Session.get().replaceSession();// used to reproduce the > issue. > > >>> > > >>> return > > >>> > > >>> AppSession.getObjAppShell().getSrcPage(); > > >>> > > >>> }); > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> *Any help?* > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> Thank you. > > >>> > > >> > > >>> > > >> > > >>> > > >> ------------------------------------------------------------ > > >>> --------- > > >>> > > >> To unsubscribe, e-mail: [email protected] > > >>> > > >> For additional commands, e-mail: [email protected] > > >>> > > >> > > >>> > > >> > > >>> > > > > >>> > > > > >>> > > ------------------------------------------------------------ > > >>> --------- > > >>> > > To unsubscribe, e-mail: [email protected] > > >>> > > For additional commands, e-mail: [email protected] > > >>> > > > > >>> > > > > >>> > > > >>> > > >> > > >> > > > > > >
