You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Patterson <jd...@gmail.com> on 2008/08/20 18:33:57 UTC

Custom PageMap

Hi, I need to store some kind of multi-request transaction data somewhere and
I guess that the PageMap is a better place than the session.  I don't see
much talk of custom page maps on the list.  Are they still a recommended way
to store things for a browser window?

John
-- 
View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19073327.html
Sent from the Wicket - User 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: Custom PageMap

Posted by John Patterson <jd...@gmail.com>.


Johan Compagner wrote:
> 
> in 1.3 with the new Disk based store we dont need by default the window
> detection yes
> so it is turned off by default.
> 

OK, and how do I turn it on?


Johan Compagner wrote:
> 
> Also the detection is pretty good but not completely solid!
> It will always be very hard to really detect and play nicely under all
> circumstances
> For example if you have 1 transaction in 1 tab and then the users does on
> a
> link or form: open in new tab?
> what then? should the transaction be transported?
> 

Well I have made this system of in-memory "unit of work" based around some
code from Jonas Boner in aspectwerkz.  I can have nested "transactions" so
you can roll back bits of a "transaction".


Johan Compagner wrote:
> 
> Maybe in 1.5 we will transform the pagemap to a first class Window object
> but i dont know if we can really make that 100% reliable
> 
> 

Sounds cool, even if it is not 100 percent reliable.  Sometimes that is
enough.


-- 
View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19086969.html
Sent from the Wicket - User 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: Custom PageMap

Posted by Johan Compagner <jc...@gmail.com>.
in 1.3 with the new Disk based store we dont need by default the window
detection yes
so it is turned off by default.

Also the detection is pretty good but not completely solid!
It will always be very hard to really detect and play nicely under all
circumstances
For example if you have 1 transaction in 1 tab and then the users does on a
link or form: open in new tab?
what then? should the transaction be transported?

Also are those transactions really down the drain database transactions? or
just in memory transactions?
long database transactions is a really really bad idea.. There are only a
very few databases that play nice
in this area (oracle and postgresql) the rest are just horrible (no Multi
Version Read Consistency)

Maybe in 1.5 we will transform the pagemap to a first class Window object
but i dont know if we can really make that 100% reliable

johan


On Thu, Aug 21, 2008 at 10:25 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> On Thu, Aug 21, 2008 at 10:22 AM, John Patterson <jd...@gmail.com>
> wrote:
> > I was just considering storing the unit-of-work in the PageMap meta-data.
>
> I haven't used that. Session is more in my comfort zone ;)
>
> > What exactly is the problem with detecting the different browser windows?
> > When does it break?
>
> Automatically detecting new windows is non-trivial, and is turned off
> by default IIRC. I'm not intimate with the details. Johan and Matej
> wrote that part and should be able to shine some light on this
> subject.
>
> Martijn
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Custom PageMap

Posted by Martijn Dashorst <ma...@gmail.com>.
On Thu, Aug 21, 2008 at 10:22 AM, John Patterson <jd...@gmail.com> wrote:
> I was just considering storing the unit-of-work in the PageMap meta-data.

I haven't used that. Session is more in my comfort zone ;)

> What exactly is the problem with detecting the different browser windows?
> When does it break?

Automatically detecting new windows is non-trivial, and is turned off
by default IIRC. I'm not intimate with the details. Johan and Matej
wrote that part and should be able to shine some light on this
subject.

Martijn

-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Custom PageMap

Posted by John Patterson <jd...@gmail.com>.


Martijn Dashorst wrote:
> 
> If you don't want to make the session contain the objects explicitly,
> because the multistep process is only a small part of your
> application, you could use session metadata to store the data
> (temporarily). This does mean that it is serialized with the session,
> but IMO that is a small price to pay (session in a single server
> environment with low memory usage should not often be serialized, only
> when the server is shutdown properly).
> 
> I haven't done multi window session storage yet, but that fails mostly
> with detecting the different browser windows. Or you could generate a
> unique number at the start of the wizard and use that to locate each
> session object. But this could lead to significant memory leaks when
> folks randomly start new wizard steps. You should limit the number of
> concurrent wizards per session I think.
> 

Thanks Martijn, yes great idea to store my "unit of work" (containing all
changed objects) in the session meta-data with an id and a maximum number.

I was just considering storing the unit-of-work in the PageMap meta-data. 
What exactly is the problem with detecting the different browser windows? 
When does it break?

JD
-- 
View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19084492.html
Sent from the Wicket - User 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: Custom PageMap

Posted by Martijn Dashorst <ma...@gmail.com>.
If you don't want to make the session contain the objects explicitly,
because the multistep process is only a small part of your
application, you could use session metadata to store the data
(temporarily). This does mean that it is serialized with the session,
but IMO that is a small price to pay (session in a single server
environment with low memory usage should not often be serialized, only
when the server is shutdown properly).

I haven't done multi window session storage yet, but that fails mostly
with detecting the different browser windows. Or you could generate a
unique number at the start of the wizard and use that to locate each
session object. But this could lead to significant memory leaks when
folks randomly start new wizard steps. You should limit the number of
concurrent wizards per session I think.

Martijn

On Thu, Aug 21, 2008 at 9:53 AM, John Patterson <jd...@gmail.com> wrote:
>
>
>
> Erik van Oosten wrote:
>>
>>
>>> The data is not serializable and is needed in several pages as a part of
>>> one transaction
>>
>> - Not serializable:
>> Well that is a hick up. This of course also means that you can not do
>> clustering. I would put the data directly in the HTTP session, or in
>> your own sub class of Wicket's WebSession. I think the page map is no
>> longer available (though perhaps that depends on the page store you
>> select).
>>
>
> The only problem with storing in the session is that there can only be one
> user transaction at a time.  It would be nice to allow separate tabs to be
> working on different items.  This is why I was asking about PageMap
>
> I remember some talk about renaming it to Window or something like that.
>
>
> Erik van Oosten wrote:
>>
>> - Part of one transaction.
>> Do you really mean like JTA transaction? Or are you talking about a
>> conversation (which was what I assumed).
>> Having multiple requests in one (JTA) transaction is not very common. I
>> guess if this is the case a reference to the transaction is part of your
>> non-serializable data.
>> If you did mean conversation/wizard kind of data, then the earlier
>> advice holds.
>>
>
> It is not a JTA transaction but a sequence of work on some objects that can
> be rolled back or committed.  These non serializable objects need to be
> stored in this "unit of work" over requests.
>
> No the earlier advice - to reference the data in the page - does not work
> for non-serializable objects.  I need to use some kind of detachable model
> to retrieve the modified data e.g. from session or pagemap.  Or to save its
> state between requests which would just be a bit inconvenient.
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19084160.html
> Sent from the Wicket - User 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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Custom PageMap

Posted by John Patterson <jd...@gmail.com>.


Erik van Oosten wrote:
> 
> 
>> The data is not serializable and is needed in several pages as a part of
>> one transaction
> 
> - Not serializable:
> Well that is a hick up. This of course also means that you can not do
> clustering. I would put the data directly in the HTTP session, or in
> your own sub class of Wicket's WebSession. I think the page map is no
> longer available (though perhaps that depends on the page store you
> select).
> 

The only problem with storing in the session is that there can only be one
user transaction at a time.  It would be nice to allow separate tabs to be
working on different items.  This is why I was asking about PageMap

I remember some talk about renaming it to Window or something like that.  


Erik van Oosten wrote:
> 
> - Part of one transaction.
> Do you really mean like JTA transaction? Or are you talking about a
> conversation (which was what I assumed).
> Having multiple requests in one (JTA) transaction is not very common. I
> guess if this is the case a reference to the transaction is part of your
> non-serializable data.
> If you did mean conversation/wizard kind of data, then the earlier
> advice holds.
> 

It is not a JTA transaction but a sequence of work on some objects that can
be rolled back or committed.  These non serializable objects need to be
stored in this "unit of work" over requests.

No the earlier advice - to reference the data in the page - does not work
for non-serializable objects.  I need to use some kind of detachable model
to retrieve the modified data e.g. from session or pagemap.  Or to save its
state between requests which would just be a bit inconvenient.




-- 
View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19084160.html
Sent from the Wicket - User 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: Custom PageMap

Posted by Erik van Oosten <e....@grons.nl>.
> The data is not serializable and is needed in several pages as a part
of one
transaction

- Not serializable:
Well that is a hick up. This of course also means that you can not do
clustering. I would put the data directly in the HTTP session, or in
your own sub class of Wicket's WebSession. I think the page map is no
longer available (though perhaps that depends on the page store you select).

- Part of one transaction.
Do you really mean like JTA transaction? Or are you talking about a
conversation (which was what I assumed).
Having multiple requests in one (JTA) transaction is not very common. I
guess if this is the case a reference to the transaction is part of your
non-serializable data.
If you did mean conversation/wizard kind of data, then the earlier
advice holds.

Good luck,
    Erik.


John Patterson wrote:
> The data is not serializable and is needed in several pages as a part of one
> transaction
>
>
> Erik van Oosten wrote:
>   
>> John, if you keep your conversation data in the component (as a java 
>> field), and you work with listeners in that component (e.g. with a 
>> Link), that data is available in the listener (e.g. Link's onClick 
>> callback method).
>>
>> While coding the component you should not worry about where that data is 
>> stored between requests. Of course you can influence this by choosing a 
>> page store during application initialization. The default however, is 
>> mostly the best choice.
>>
>> Regards,
>>      Erik.
>>
>>
>>
>> John Patterson wrote:
>>     
>>> Hi, I need to store some kind of multi-request transaction data somewhere
>>> and
>>> I guess that the PageMap is a better place than the session.  I don't see
>>> much talk of custom page maps on the list.  Are they still a recommended
>>> way
>>> to store things for a browser window?
>>>
>>> John
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>   

-- 

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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


Re: Custom PageMap

Posted by John Patterson <jd...@gmail.com>.
The data is not serializable and is needed in several pages as a part of one
transaction


Erik van Oosten wrote:
> 
> John, if you keep your conversation data in the component (as a java 
> field), and you work with listeners in that component (e.g. with a 
> Link), that data is available in the listener (e.g. Link's onClick 
> callback method).
> 
> While coding the component you should not worry about where that data is 
> stored between requests. Of course you can influence this by choosing a 
> page store during application initialization. The default however, is 
> mostly the best choice.
> 
> Regards,
>      Erik.
> 
> 
> 
> John Patterson wrote:
>> Hi, I need to store some kind of multi-request transaction data somewhere
>> and
>> I guess that the PageMap is a better place than the session.  I don't see
>> much talk of custom page maps on the list.  Are they still a recommended
>> way
>> to store things for a browser window?
>>
>> John
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Custom-PageMap-tp19073327p19082028.html
Sent from the Wicket - User 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: Custom PageMap

Posted by Erik van Oosten <e....@grons.nl>.
John, if you keep your conversation data in the component (as a java 
field), and you work with listeners in that component (e.g. with a 
Link), that data is available in the listener (e.g. Link's onClick 
callback method).

While coding the component you should not worry about where that data is 
stored between requests. Of course you can influence this by choosing a 
page store during application initialization. The default however, is 
mostly the best choice.

Regards,
     Erik.



John Patterson wrote:
> Hi, I need to store some kind of multi-request transaction data somewhere and
> I guess that the PageMap is a better place than the session.  I don't see
> much talk of custom page maps on the list.  Are they still a recommended way
> to store things for a browser window?
>
> John
>   


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