Wicket already does this. Please check https://ci.apache.org/projects/wicket/guide/7.x/guide/internals.html#pagestoring In short: The stateful page(s) used in the last request cycle are stored in the http session as live instances, because the chance to reuse it/them is high, e.g. clicking a link. Additionally the same page(s) are also stored on the disk as byte[]. If you use browser's back button then Wicket will deserialize the page from the disk. So you can just keep the page id around and use getSession().getPageManager().getPage(pageId) to get a reference to a page. The size of the file for storing session's pages on disk is limited (see StoreSettings), so after some time a page expires, i.e. it is removed from the disk. You can "touch" it from time to time (e.g. on every request) to keep it in the file.
Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Apr 26, 2016 at 10:29 PM, Lon Varscsak <[email protected]> wrote: > To be clearer, I just basically want to take a page that the user is on, > keep a reference to it, and return the user back to it at some point in the > future. It seems to work fine (I’m used to doing this since Apple’s > WebObjects is similar), but I just wanted to make sure I didn’t paint > myself into a corner. :P > > On Tue, Apr 26, 2016 at 1:25 PM, Lon Varscsak <[email protected]> > wrote: > > > So by sending me there are you suggesting that storing an iVar to a page > > object is bad? > > > > On Tue, Apr 26, 2016 at 1:00 PM, Martin Grigorov <[email protected]> > > wrote: > > > >> Hi, > >> > >> Take a look at https://github.com/martin-g/single-page-instance and the > >> discussion about it at http://markmail.org/message/ofyvgybcjp5cvf75 > >> Might be useful for you! > >> > >> Martin Grigorov > >> Wicket Training and Consulting > >> https://twitter.com/mtgrigorov > >> > >> On Tue, Apr 26, 2016 at 6:22 PM, Lon Varscsak <[email protected]> > >> wrote: > >> > >> > Is it bad to store pages in the session for re-use? The idea being > that > >> > for a given page, I only want one instance per session. > >> > > >> > -Lon (Wicket Newb) > >> > > >> > > > > >
