You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by miro <mi...@yahoo.com> on 2008/12/11 22:35:51 UTC

wicket pages as spring beans to utilize spring aop

I want to use spring aop on my pages , so was wondering if it is possible to
make pages as proxy scoped spring beans    and wicket will  use spring
application context to retrieve page instance  , I actually wanted to add
introduction to some of my pages   and  for  whcih  I cannot use spring aop
and must use some aop like aspectJ or something  else .
-- 
View this message in context: http://www.nabble.com/wicket-pages-as---spring-beans--to-utilize-spring-aop-tp20964746p20964746.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: wicket pages as spring beans to utilize spring aop

Posted by Martijn Dashorst <ma...@gmail.com>.
IMO this is way outside the normal use pattern of Wicket. Wicket's
pages are unmanaged and untied to Spring, and we intend to keep it
that way.

What you want has an enormous impact on the way you construct wicket
pages. You'll need to extend this to the component level (Panels and
borders come to mind), and then suddenly Wicket becomes managed by
your IoC container. Not a pretty sight.

Martijn

On Thu, Dec 11, 2008 at 10:35 PM, miro <mi...@yahoo.com> wrote:
>
> I want to use spring aop on my pages , so was wondering if it is possible to
> make pages as proxy scoped spring beans    and wicket will  use spring
> application context to retrieve page instance  , I actually wanted to add
> introduction to some of my pages   and  for  whcih  I cannot use spring aop
> and must use some aop like aspectJ or something  else .
> --
> View this message in context: http://www.nabble.com/wicket-pages-as---spring-beans--to-utilize-spring-aop-tp20964746p20964746.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: wicket pages as spring beans to utilize spring aop

Posted by Jeremy Thomerson <je...@wickettraining.com>.
RE: ThreadLocal - NO!  And don't do this....  Setting the response page
(with redirect) is going to send a response to the browser that tells it to
redirect to the new page.  Then your response is closed - meaning that the
servlet container is done using that thread for that user, and will use it
the next time a request comes in and it needs it.  Now, if some other user
browses a page, the servlet container may use that thread for them, and you
will receive user A's data from the thread local for user B.  Meanwhile, you
have no idea what thread the request from user A ends up in when he requests
the page he was redirected to.

You should not try to use thread locals in your webapp unless you really
manage them VERY closely.  Why not put the data on the session, or in the
page / panel / etc.... that Wicket is already handling the complex stuff
for?

On Fri, Dec 12, 2008 at 1:17 PM, miro <mi...@yahoo.com> wrote:

>
> Yes its   the same problem I resolved it with the suggestion you pointed
> aspectJ.I am using aspectJ compiler to   introduce some meta information to
> my pages, the only reason I donot want to have super class   is the ability
> to swap a class use it or not with least changes and in my case just an
> annotation.
> By the way If I set some an object in threadlocal in onClick method and
> call
> setResponsePage() and setRediret(true)  will I  have this object in thread
> in the new page ?
>
> jWeekend wrote:
> >
> > Miro,
> >
> > Is this related to the CGLIB problem you were having? Did the Spring guys
> > find an answer on their forum? If you did solve it, what did your fix
> > entail?
> >
> > In terms of "introducing" stuff to your pages, given that the framework
> > will never be aware and able to utilise any such introduction there seems
> > to be little benefit in making introductions directly to the page; why
> not
> > make a base class for the pages you have in mind that can hold a
> reference
> > to an object which is the target of the introduction (it can be an inner
> > class if you need to access your page instance's state)? Is that not a
> > simpler design (ie you don't have to design your own custom page
> > resolution for Wicket).
> >
> > If you really want to add a new way for Wicket to locate pages (ie as
> > Spring managed beans as you say), I'd start by looking at how the
> > IRequestTarget,  RequestCycle and general mount strategy implementations
> > interact but I'm sure one of the core developers will be able to give you
> > a good steer - it's an interesting question (albeit, possibly academic).
> >
> > By the way, I guess you know that you can use AspectJ type configuration
> > for Spring AOP, so you could write your aspects in a way applicable to
> > both, but include an aop.xml in your MATA-INF and add the AspectJ agent
> to
> > your command line to enable introduction to unmanaged beans whilst
> > avoiding the "self" problem.
> >
> > Regards - Cemal
> >  http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> jWeekend
> >
> >
> >
> > miro wrote:
> >>
> >> I want to use spring aop on my pages , so was wondering if it is
> possible
> >> to make pages as proxy scoped spring beans    and wicket will  use
> spring
> >> application context to retrieve page instance  , I actually wanted to
> add
> >> introduction to some of my pages   and  for  whcih  I cannot use spring
> >> aop and must use some aop like aspectJ or something  else .
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/wicket-pages-as---spring-beans--to-utilize-spring-aop-tp20964746p20981833.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
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: wicket pages as spring beans to utilize spring aop

Posted by miro <mi...@yahoo.com>.
Yes its   the same problem I resolved it with the suggestion you pointed
aspectJ.I am using aspectJ compiler to   introduce some meta information to
my pages, the only reason I donot want to have super class   is the ability
to swap a class use it or not with least changes and in my case just an
annotation.
By the way If I set some an object in threadlocal in onClick method and call
setResponsePage() and setRediret(true)  will I  have this object in thread
in the new page ?

jWeekend wrote:
> 
> Miro,
> 
> Is this related to the CGLIB problem you were having? Did the Spring guys
> find an answer on their forum? If you did solve it, what did your fix
> entail? 
> 
> In terms of "introducing" stuff to your pages, given that the framework
> will never be aware and able to utilise any such introduction there seems
> to be little benefit in making introductions directly to the page; why not
> make a base class for the pages you have in mind that can hold a reference
> to an object which is the target of the introduction (it can be an inner
> class if you need to access your page instance's state)? Is that not a
> simpler design (ie you don't have to design your own custom page
> resolution for Wicket).
> 
> If you really want to add a new way for Wicket to locate pages (ie as
> Spring managed beans as you say), I'd start by looking at how the
> IRequestTarget,  RequestCycle and general mount strategy implementations
> interact but I'm sure one of the core developers will be able to give you
> a good steer - it's an interesting question (albeit, possibly academic).
> 
> By the way, I guess you know that you can use AspectJ type configuration
> for Spring AOP, so you could write your aspects in a way applicable to
> both, but include an aop.xml in your MATA-INF and add the AspectJ agent to
> your command line to enable introduction to unmanaged beans whilst
> avoiding the "self" problem.
> 
> Regards - Cemal
>  http://www.jWeekend.co.uk jWeekend 
> 
>  
> 
> miro wrote:
>> 
>> I want to use spring aop on my pages , so was wondering if it is possible
>> to make pages as proxy scoped spring beans    and wicket will  use spring
>> application context to retrieve page instance  , I actually wanted to add
>> introduction to some of my pages   and  for  whcih  I cannot use spring
>> aop and must use some aop like aspectJ or something  else .
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/wicket-pages-as---spring-beans--to-utilize-spring-aop-tp20964746p20981833.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: wicket pages as spring beans to utilize spring aop

Posted by jWeekend <jw...@cabouge.com>.
Miro,

Is this related to the CGLIB problem you were having? Did the Spring guys
find an answer on their forum? If you did solve it, what did your fix
entail? 

In terms of "introducing" stuff to your pages, given that the framework will
never be aware and able to utilise any such introduction there seems to be
little benefit in making introductions directly to the page; why not make a
base class for the pages you have in mind that can hold a reference to an
object which is the target of the introduction (it can be an inner class if
you need to access your page instance's state)? Is that not a simpler design
(ie you don't have to design your own custom page resolution for Wicket).

If you really want to add a new way for Wicket to locate pages (ie as Spring
managed beans as you say), I'd start by looking at how the IRequestTarget, 
RequestCycle and general mount strategy implementations interact but I'm
sure one of the core developers will be able to give you a good steer - it's
an interesting question (albeit, possibly academic).

By the way, I guess you know that you can use AspectJ type configuration for
Spring AOP, so you could write your aspects in a way applicable to both, but
include an aop.xml in your MATA-INF and add the AspectJ agent to your
command line to enable introduction to unmanaged beans whilst avoiding the
"self" problem.

Regards - Cemal
http://www.jWeekend.co.uk jWeekend 

 

miro wrote:
> 
> I want to use spring aop on my pages , so was wondering if it is possible
> to make pages as proxy scoped spring beans    and wicket will  use spring
> application context to retrieve page instance  , I actually wanted to add
> introduction to some of my pages   and  for  whcih  I cannot use spring
> aop and must use some aop like aspectJ or something  else .
> 

-- 
View this message in context: http://www.nabble.com/wicket-pages-as---spring-beans--to-utilize-spring-aop-tp20964746p20964816.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