You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jan Kriesten <ja...@renitence.de> on 2007/08/23 12:31:37 UTC
PageStore listener...
Hi,
is there a way to add a listener to PageStore events (storePage/getPage)?
I'm still looking for a clean way to re-inject Pages/Components when they are
deserialized. This way I could just set some fields transient and have them
injected again if necessary.
I gave IComponentOnBeforeRenderListener a look as a hook to do this, but that is
called _after_ Components onBeforeRender(), so it's not usable for that.
Regards, --- Jan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PageStore listener...
Posted by Igor Vaynberg <ig...@gmail.com>.
well, that is pretty interesting. set a break point after the injection has
finished and see what really is assigned to that field. i didnt write the
guice injector, but from what i can see it always injects wicket's lazy
lookup proxy. you should see something like:
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler@105eb6f
one peculiar thing that i see is GuiceProxyTargetLocator keeps a reference
to java.lang.annotation.Annotation which is not necessarily serializable,
but the GuiceInjectorTest passes fine, so it must be :|
please paste the entire stack trace of the error. wicket has a serialization
checker which is very good at pinpointing the problematic field - it should
be output as an error/warning into your log.
-igor
On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
>
>
> hi igor,
>
> > are you using wicket-guice? or just the guice' raw injection?
>
> wicket-guice:
>
> addComponentInstantiationListener( new GuiceComponentInjector( this,
> injector ) );
>
> regards, --- jan.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: PageStore listener...
Posted by Jan Kriesten <ja...@renitence.de>.
hi igor,
> are you using wicket-guice? or just the guice' raw injection?
wicket-guice:
addComponentInstantiationListener( new GuiceComponentInjector( this, injector ) );
regards, --- jan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PageStore listener...
Posted by Igor Vaynberg <ig...@gmail.com>.
are you using wicket-guice? or just the guice' raw injection?
-igor
On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
>
>
> hi igor,
>
> > public mypanel extends panel {
> > @SpringBean private Service service;
>
> actually, if i use guice-injection
>
> @Inject private ContentManager cm;
>
> where ContentManager isn't serializable, i get tons of exceptions
> regarding 'not
> serializable.
>
> so, to me it seems that the proxy-stuff not always applies.
>
> i wouldn't have asked if i hadn't had any trouble with this.
>
> regards, --- jan.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: PageStore listener...
Posted by Jan Kriesten <ja...@renitence.de>.
hi igor,
> public mypanel extends panel {
> @SpringBean private Service service;
actually, if i use guice-injection
@Inject private ContentManager cm;
where ContentManager isn't serializable, i get tons of exceptions regarding 'not
serializable.
so, to me it seems that the proxy-stuff not always applies.
i wouldn't have asked if i hadn't had any trouble with this.
regards, --- jan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PageStore listener...
Posted by Igor Vaynberg <ig...@gmail.com>.
On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
>
>
> hi matej, hi johan,
>
> > Why can't you just implement read/writeObject on your page/component?
>
> that would be an effort... here a listview, there a link and over there
> another
> image...
>
> that way i loose all the benefits of using injection - i build new logic
> in the
> components which i just wanted to get rid of.
>
> > Or make the fields itself not transient, but a proxy that has a
> transient
> > field and the proxy can deserialize and inject itself again (see
> wicket-ioc
> > project)
>
> possible, but that reminds me on the 'XYService.getInstance()' usage in
> the
> times before IoC. it adds another indirection which makes should-be-easy
> things
> more complex. instead of being able to just inject the right class
> instances, i
> have to use proxies (so being on the save side when changing
> classes/implementations break serialization).
really, so this is too complicated?
public mypanel extends panel {
@SpringBean private Service service;
...
}
-igor
regards, --- jan.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: PageStore listener...
Posted by Matej Knopp <ma...@gmail.com>.
There is wicket-ioc project that does the injection, but if you feel
like reinventing the wheel, be my guest.
-Matej
On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
>
> hi matej, hi johan,
>
> > Why can't you just implement read/writeObject on your page/component?
>
> that would be an effort... here a listview, there a link and over there another
> image...
>
> that way i loose all the benefits of using injection - i build new logic in the
> components which i just wanted to get rid of.
>
> > Or make the fields itself not transient, but a proxy that has a transient
> > field and the proxy can deserialize and inject itself again (see wicket-ioc
> > project)
>
> possible, but that reminds me on the 'XYService.getInstance()' usage in the
> times before IoC. it adds another indirection which makes should-be-easy things
> more complex. instead of being able to just inject the right class instances, i
> have to use proxies (so being on the save side when changing
> classes/implementations break serialization).
>
> there's the onComponentInstantiationListener() - easy to use and powerful. if
> there would be some listener being called before any other component logic is
> being performed that would be great. it would be enough to call this once during
> a request-cycle to minimize the overhead.
>
> btw, why is the OnBeforeRenderListener called after and not before
> OnBeforeRender() of the component?
>
> regards, --- jan.
>
>
> ---------------------------------------------------------------------
> 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: PageStore listener...
Posted by Jan Kriesten <ja...@renitence.de>.
hi matej, hi johan,
> Why can't you just implement read/writeObject on your page/component?
that would be an effort... here a listview, there a link and over there another
image...
that way i loose all the benefits of using injection - i build new logic in the
components which i just wanted to get rid of.
> Or make the fields itself not transient, but a proxy that has a transient
> field and the proxy can deserialize and inject itself again (see wicket-ioc
> project)
possible, but that reminds me on the 'XYService.getInstance()' usage in the
times before IoC. it adds another indirection which makes should-be-easy things
more complex. instead of being able to just inject the right class instances, i
have to use proxies (so being on the save side when changing
classes/implementations break serialization).
there's the onComponentInstantiationListener() - easy to use and powerful. if
there would be some listener being called before any other component logic is
being performed that would be great. it would be enough to call this once during
a request-cycle to minimize the overhead.
btw, why is the OnBeforeRenderListener called after and not before
OnBeforeRender() of the component?
regards, --- jan.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: PageStore listener...
Posted by Johan Compagner <jc...@gmail.com>.
Or make the fields itself not transient, but a proxy that has a transient
field
and the proxy can deserialize and inject itself again (see wicket-ioc
project)
johan
On 8/23/07, Matej Knopp <ma...@gmail.com> wrote:
>
> Why can't you just implement read/writeObject on your page/component?
>
> -Matej
>
> On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
> >
> > Hi,
> >
> > is there a way to add a listener to PageStore events
> (storePage/getPage)?
> >
> > I'm still looking for a clean way to re-inject Pages/Components when
> they are
> > deserialized. This way I could just set some fields transient and have
> them
> > injected again if necessary.
> >
> > I gave IComponentOnBeforeRenderListener a look as a hook to do this, but
> that is
> > called _after_ Components onBeforeRender(), so it's not usable for that.
> >
> > Regards, --- Jan.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: PageStore listener...
Posted by Matej Knopp <ma...@gmail.com>.
Why can't you just implement read/writeObject on your page/component?
-Matej
On 8/23/07, Jan Kriesten <ja...@renitence.de> wrote:
>
> Hi,
>
> is there a way to add a listener to PageStore events (storePage/getPage)?
>
> I'm still looking for a clean way to re-inject Pages/Components when they are
> deserialized. This way I could just set some fields transient and have them
> injected again if necessary.
>
> I gave IComponentOnBeforeRenderListener a look as a hook to do this, but that is
> called _after_ Components onBeforeRender(), so it's not usable for that.
>
> Regards, --- Jan.
>
>
>
> ---------------------------------------------------------------------
> 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