You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by gmparker2000 <gr...@brovada.com> on 2014/01/13 18:42:58 UTC

Models and page serialization

I would like to be able to analyze a particular Wicket page to determine
where I might be using models incorrectly.  The model behind the page is a
very nested serializable object that is kept in a document cache.  The idea
is to use a loadable detachable model that will retrieve the object from the
cache on load.  However, I'm fairly certain that there are places where
objects from within the object hierarchy are being used incorrectly.   I'm
assuming that this probably results in portions of the object getting
serialized with the page.  Are there any tools or logging that would let me
see the serialized page in a readable format?  I guess one way I could
analyze the problem is to make my object unserializable and work through the
errors.  Any other ideas?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668.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: Models and page serialization

Posted by Martin Grigorov <mg...@apache.org>.
Do your business objects have common property ?
base class/interface, annotation, ... ?
If YES then you can check for it and write the nice error message when you
see such.

Martin Grigorov
Wicket Training and Consulting


On Wed, Jan 15, 2014 at 10:29 PM, gmparker2000 <gr...@brovada.com>wrote:

> The problem is that my business objects do implement serializable for
> another
> reason.  However, I don't want Wicket to serialize them.  So I could remove
> Serializable and see what happens but I was hoping for a way to just look
> at
> what is getting serialized.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668p4663758.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: Models and page serialization

Posted by gmparker2000 <gr...@brovada.com>.
The problem is that my business objects do implement serializable for another
reason.  However, I don't want Wicket to serialize them.  So I could remove
Serializable and see what happens but I was hoping for a way to just look at
what is getting serialized.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668p4663758.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: Models and page serialization

Posted by Martin Grigorov <mg...@apache.org>.
See for example SerializableChecker.
It does the same - checks that a serialized object implements
java.io.Serializable.
If it doesn't then it prints a nice message explaining where this object is
used.

Martin Grigorov
Wicket Training and Consulting


On Wed, Jan 15, 2014 at 6:29 PM, gmparker2000 <gr...@brovada.com>wrote:

> Thanks for the tip.  I'm a little unclear on what this is telling me
> though.
> Wouldn't this just tell me if the detach method of all my LDMs was called?
> What I'm interested in determining is where my LDMs are directly
> referencing
> objects that will inadvertantly get serialized with the LDM.   For example,
> if an LDM has a member variable pointing to an object or the LDM accesses a
> final variable from its parent class.  I want to be sure I'm not
> serializing
> business objects or references to business objects along with the page.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668p4663746.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: Models and page serialization

Posted by gmparker2000 <gr...@brovada.com>.
Thanks for the tip.  I'm a little unclear on what this is telling me though. 
Wouldn't this just tell me if the detach method of all my LDMs was called? 
What I'm interested in determining is where my LDMs are directly referencing
objects that will inadvertantly get serialized with the LDM.   For example,
if an LDM has a member variable pointing to an object or the LDM accesses a
final variable from its parent class.  I want to be sure I'm not serializing
business objects or references to business objects along with the page.  

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668p4663746.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: Models and page serialization

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

If you use Wicket 6.x then you can use special impl
of org.apache.wicket.core.util.objects.checker.IObjectChecker
To use it you have to
extend org.apache.wicket.serialize.java.JavaSerializer#newObjectOutputStream.
See for example
how org.apache.wicket.serialize.java.JavaSerializer.SerializationCheckerObjectOutputStream#writeObjectOverride
uses SerializableChecker.

Martin Grigorov
Wicket Training and Consulting


On Mon, Jan 13, 2014 at 7:42 PM, gmparker2000 <gr...@brovada.com>wrote:

> I would like to be able to analyze a particular Wicket page to determine
> where I might be using models incorrectly.  The model behind the page is a
> very nested serializable object that is kept in a document cache.  The idea
> is to use a loadable detachable model that will retrieve the object from
> the
> cache on load.  However, I'm fairly certain that there are places where
> objects from within the object hierarchy are being used incorrectly.   I'm
> assuming that this probably results in portions of the object getting
> serialized with the page.  Are there any tools or logging that would let me
> see the serialized page in a readable format?  I guess one way I could
> analyze the problem is to make my object unserializable and work through
> the
> errors.  Any other ideas?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Models-and-page-serialization-tp4663668.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
>
>