Hey Michael,

On Mon, Apr 9, 2012 at 09:16, Michael Szalay <michael.sza...@gmail.com> wrote:
> I'm evaluating pax-wicket 1.0.0 running on apache Karaf an have a few
> problems:
>
> a) Serialization of injected services:
>
> I'm injecting osgi-services using the PaxWicketBean annotation, like this:
>
> @PaxWicketBean(name = "searchService", injectionSource =
> PaxWicketBean.INJECTION_SOURCE_BLUEPRINT)
> private transient SearchService search;

First of all: the injection source is typically not required;
pax-wicket automatically determines the available source and uses it.

> As this is in a wicket page, it is Serializable, but my osgi-services of
> course aren't...
> so I declare it transient.
> When the page is called the second time, the SearchService is null, the
> first time it works.
>
> When I remove the "transient" modifier, there a lot a bunch of
> NotSerializable-Exceptions in the log
> and nothing works..
>
> What Is the solution to deal with this problem? I can't make the services
> all serializable,
> since they are not my code...
> Is there a way to tell pax-wicket to not serialize the pages in a that
> strictly way?

Well, the solution is definitely not to set the services transient or
to set them serializable. Nevertheless, what you mentioned is a bit of
a problem. Wicket stores services at various locations and you run
quite frequently into a situation where wicket itself tries to
serialize them. Typically those problems occur where you try to "give"
services into subcomponents. E.g. via a constructor, or a setter, or
... Basically the PaxWicketBean annotation is filled for every
component again. Therefore you should NEVER store a bean injected
using PaxWicketBean anywhere but only use it. You can inject beans
into components, panels, pages, ... everywhere you like. Make use of
it.

I hope this answers your question. If not feel free to give the code
samples a glance
https://github.com/ops4j/org.ops4j.pax.wicket/tree/master/samples or
feel free to publish the code snippets here (or send them to me
privately) and I'll give them a shot.

> b) Injecting services which have a constructor with argument
>
> When I try to inject a service which has a constructor with argument, this
> gives a cglib-error when
> pax-wicket tries to create a proxy to it.

Can you give an example here? I can't imagine how this can happen. The
entire construction is done by blueprint. Pax-Wicket only takes the
beans from the blueprint context. So I'm not sure how an exception can
happen here. It would definitely help if you could give me some
examples here of what you're trying to do.

> c) Authorization:
>
> Does role-based authorization work? I did'nt find the method
> "setAuthenticator" anymore...
> The wicket annotation seems not to be checked.

Yes, that definitely work. I do it myself with various wicket
applications using pax-wicket. You need to set your own session in the
application. This should do the trick; in other words, what works in a
classical wicket app (e.g. auth) should work in pax-wicket the same
way. If you use something I've not used/tested by now (it's always
possible that we forgot a use case) please post a sample which will
work with plain wicket (attach it to a jira) and we'll give it a shot.

Thank you your interest in Pax Wicket; I hope I was able to help you
at least with some of your questions.Feel free to ask again if I was
not able to answer something clearly enough.

Kind regardsl,
Andreas

>
> Regards Michael
>
> _______________________________________________
> general mailing list
> general@lists.ops4j.org
> http://lists.ops4j.org/mailman/listinfo/general

_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to