There are two problems with creating a spring web page factory:
1) pages get serialized and you don't want to serialize all the enjected
deps along with it, so you need a mechanism that reinjects the dependencies
whenever a page is activated - or whenever a page references another page
that has been serialized. This can be difficult to achieve transparently and
can get expensive.
2) to use the page factory your pages can only have the default or
PageParameter constructors. This prevents you from doing things like
setResponsePage(new EditUserPage(userId));
I still think the webapplication subclass is the best place for injecting
dependencies. In your base page class you can create helpers that retrieve
the deps from the webapp subclass:
Ie
Class BasePage extends WebPage() {
UserService getUserService() {
return
((MyWebAppSubclass())getApplication()).getUserService();
}
}
-Igor
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Ryan Sonnek
> Sent: Sunday, October 23, 2005 12:27 PM
> To: [email protected]
> Subject: Re: [Wicket-user] My take on Spring integration
>
> I agree. Without taking the extra step to create a Spring
> web page factory, this solution is still missing something.
>
> I took some time a while ago and put together a spring web
> page factory that would inject the spring services directly
> into the page.
> It wasn't too difficult, and i definately think wicket would
> benefit from a stronger spring integration.
>
> On 10/22/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > But then, aside from the embedded jetty, this is no
> different from the
> > Page-level integration section of
> > http://www.wicket-wiki.org.uk/wiki/index.php/SpringIntegration
> >
> > Am I totally missing something?
> >
> > -Igor
> >
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On
> Behalf Of Stefan
> > > Arentz
> > > Sent: Saturday, October 22, 2005 9:45 AM
> > > To: [email protected]
> > > Subject: Re: [Wicket-user] My take on Spring integration
> > >
> > >
> > > On Oct 22, 2005, at 6:37 PM, Igor Vaynberg wrote:
> > >
> > > > Where/how is the mHelloWorldService injeted into the page?
> > > > -Igor
> > >
> > > It is not injected in the page. Only in the WebApplication.
> > >
> > > I haven't figured that out yet, but I'm also not sure if
> you want to
> > > inject stuff in pages. I will find out when I am ready to
> let some
> > > components talk to services that I have exposed in
> spring. This is
> > > just a first step :-)
> > >
> > > S.
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by the JBoss Inc.
> > > Get Certified Today * Register for a JBoss Training Course Free
> > > Certification Exam for All Training Attendees Through End of 2005
> > > Visit http://www.jboss.com/services/certification
> > > for more information
> _______________________________________________
> > > Wicket-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by the JBoss Inc.
> > Get Certified Today * Register for a JBoss Training Course Free
> > Certification Exam for All Training Attendees Through End of 2005
> > Visit http://www.jboss.com/services/certification for more
> information
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through
> End of 2005 Visit http://www.jboss.com/services/certification
> for more information _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user