You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Donohoe Digital <do...@donohoe.info> on 2011/07/22 05:31:21 UTC

PageMap in 1.5

I'm porting this sample scala/wicket application from Wicket 1.4 to 1.5. 
I've almost completely got it figured out except for this bit of code from a
class that extends RequestCycle (it does some basic
EntityManager/Transaction stuff):

  override def onEndRequest =
  {
    super.onEndRequest()
    if (em != null)
    {
      if (em.getTransaction().isActive()) em.getTransaction().commit()
      em.close()
    }

    // TODO: in 1.5 page maps no longer in use - not sure why they'd want to
do this to begin with...
    // TODO: ahhh, maybe to prevent hitting 'back button'?
    //if (_endConversation) getRequest().getPage().getPageMap().remove()
  }


The line I have commented out at the end is what I can't find an equivalent
for in Wicket 1.5.

Whether or not this is the proper way to do database stuff is really not
important to me - please don't let that distract from the question.  For
those that are curious, the _endConversation flag is set in the body of a
form's onSubmit() method, after data is written to the database.

What I'm really interested in is 

a) Why would someone want to remove the page map from the session in Wicket
1.4? like above  Is my comment correct that it prevents hitting the back
button and re-submitting a form?

b) What is the Wicket 1.5 way of handling a situation like this?  I looked
at some other related posts on these forums, but haven't found a good
description yet.

c) In general, how does page caching work in Wicket 1.5?  There isn't much
on the migrating wiki page...

Thanks,

-Doug


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageMap-in-1-5-tp3685858p3685858.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageMap in 1.5

Posted by Igor Vaynberg <ig...@gmail.com>.
On Thu, Jul 21, 2011 at 8:31 PM, Donohoe Digital <do...@donohoe.info> wrote:
> I'm porting this sample scala/wicket application from Wicket 1.4 to 1.5.
> I've almost completely got it figured out except for this bit of code from a
> class that extends RequestCycle (it does some basic
> EntityManager/Transaction stuff):
>
>  override def onEndRequest =
>  {
>    super.onEndRequest()
>    if (em != null)
>    {
>      if (em.getTransaction().isActive()) em.getTransaction().commit()
>      em.close()
>    }
>
>    // TODO: in 1.5 page maps no longer in use - not sure why they'd want to
> do this to begin with...
>    // TODO: ahhh, maybe to prevent hitting 'back button'?
>    //if (_endConversation) getRequest().getPage().getPageMap().remove()
>  }
>
>
> The line I have commented out at the end is what I can't find an equivalent
> for in Wicket 1.5.
>
> Whether or not this is the proper way to do database stuff is really not
> important to me - please don't let that distract from the question.  For
> those that are curious, the _endConversation flag is set in the body of a
> form's onSubmit() method, after data is written to the database.
>
> What I'm really interested in is
>
> a) Why would someone want to remove the page map from the session in Wicket
> 1.4? like above  Is my comment correct that it prevents hitting the back
> button and re-submitting a form?

i can only guess and say that all pages in the pagemap are part of the
conversation and once the conversation is over/discarded the pagemap
is removed so pages in that pagemap/conversation are no longer
accessible. if the user tries to click back to a page and click any
link on it they will get the page expired exception.

> b) What is the Wicket 1.5 way of handling a situation like this?  I looked
> at some other related posts on these forums, but haven't found a good
> description yet.

dont think we have a replacement for this, actually. what we would
need is ipagemanager#removePage(int id). that will only handle
removing a single page though. if you have more pages that are part of
a conversation you will have to track them all so the last page of the
conversation knows all other pages that paricipated. this should be
easy since somehow you must already be propagating the conversation
somehow. then when conversation is over the code can access the list,
from pages metadata?, and remove all pages. feel free to add an rfe
for the remove() method.

> c) In general, how does page caching work in Wicket 1.5?  There isn't much
> on the migrating wiki page...

martin has already answered that in another email...


-igor

>
> Thanks,
>
> -Doug
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageMap-in-1-5-tp3685858p3685858.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageMap in 1.5

Posted by Donohoe Digital <do...@donohoe.info>.
Let me simplify my original question.  If in the past I could do this:

getRequest().getPage().getPageMap().remove() 

a) What was the practical purpose of removing page maps from sessions (i.e.,
this API existed for a purpose - what was it)?
b) What do I do in 1.5 to accomplish the same thing now that PageMaps are
gone?

I suspect this has something to do with back button support and page
history.  This wiki page
(https://cwiki.apache.org/WICKET/caching-in-wicket-15.html) discusses
caching, true.  I guess what I'm looking for is a discussion of PageManager
(the replacement for PageMaps).  How does this work in 1.5?

-Doug


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageMap-in-1-5-tp3685858p3686882.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageMap in 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Jul 22, 2011 at 6:31 AM, Donohoe Digital <do...@donohoe.info> wrote:
> I'm porting this sample scala/wicket application from Wicket 1.4 to 1.5.
> I've almost completely got it figured out except for this bit of code from a
> class that extends RequestCycle (it does some basic
> EntityManager/Transaction stuff):
>
>  override def onEndRequest =
>  {
>    super.onEndRequest()
>    if (em != null)
>    {
>      if (em.getTransaction().isActive()) em.getTransaction().commit()
>      em.close()
>    }
>
>    // TODO: in 1.5 page maps no longer in use - not sure why they'd want to
> do this to begin with...
>    // TODO: ahhh, maybe to prevent hitting 'back button'?
>    //if (_endConversation) getRequest().getPage().getPageMap().remove()
>  }
>
>
> The line I have commented out at the end is what I can't find an equivalent
> for in Wicket 1.5.
>
> Whether or not this is the proper way to do database stuff is really not
> important to me - please don't let that distract from the question.  For
> those that are curious, the _endConversation flag is set in the body of a
> form's onSubmit() method, after data is written to the database.
>
> What I'm really interested in is
>
> a) Why would someone want to remove the page map from the session in Wicket
> 1.4? like above  Is my comment correct that it prevents hitting the back
> button and re-submitting a form?
no idea
>
> b) What is the Wicket 1.5 way of handling a situation like this?  I looked
> at some other related posts on these forums, but haven't found a good
> description yet.
>
> c) In general, how does page caching work in Wicket 1.5?  There isn't much
> on the migrating wiki page...
The migration page has a note at the top mentioning other wiki pages for 1.5.
There is a page for cache http headers and page storages. You need the
second one.
>
> Thanks,
>
> -Doug
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageMap-in-1-5-tp3685858p3685858.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org