click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <>
Subject Re: Page factory service
Date Sat, 27 Apr 2013 08:37:56 GMT
Wouldn't the PageFactory complicate config? So instead of:

one would need to do:



     <page-factory-service classname="org.example.SpringPageFactoryService"/>
     <page-interceptor  classname="org.example.SpringPageInterceptor"/>

I'm not against the idea, I just don't see the use case being solved yet?

Is there something in CDI that won't work with a ClickServlet subclass eg: CDIClickServlet?

Would it help if page creation is moved to ConfigService?

Kind regards


On 2013/04/27 03:05, Dennis M. J. Yerger wrote:
> Thanks for the link, Bob. After examining the SpringClickServlet source code, I believe
most of 
> the code can fit into an implementation of PageFactoryService. The only questionable
part of the 
> code would be the contents of activatePageInstance(). Subclassing ClickServlet is really
> necessary if you want to override activatePageInstance() to support stateful pages. As
> alternative, The activatePageInstance() contents can go into an implementation of PageInterceptor,

> making a subclass of ClickServlet unnecessary. Any other setup code should nicely into

> PageFactoryService.onInit().
> An xml-based configuration might look like this:
> <click-app>
>      ...
>      <page-factory-service classname="org.example.SpringPageFactoryService"/>
>      <page-interceptor  classname="org.example.SpringPageInterceptor"/>
> </click-app>
> The Spring application context may be stored as a servlet context attribute so it can
be accessed 
> by both the interceptor and page factory.
> ----------------------------------------------------------------------------------------------------
> Date: Fri, 26 Apr 2013 20:44:04 +0200
> From:
> To:
> Subject: Re: Page factory service
> It's in the extras package 'spring'.
> Kind regards
> Bob
> On 2013/04/26 19:03, Dennis M. J. Yerger wrote:
>     Hi, Bob. I have not seen the code for SpringClickServlet, so I cannot determine whether
>     subclassing is necessary. Would you post a link to the source code?
>     ----------------------------------------------------------------------------------------------------
>     Date: Fri, 26 Apr 2013 13:05:31 +0200
>     From: <>
>     To: <>
>     Subject: Re: Page factory service
>     Hi Denis,
>     On 2013/04/25 22:13, Dennis M. J. Yerger wrote:
>         After examining the ClickServlet class, I noticed the newPageInstance() method,
which is
>         where new instances of Page objects are created. By default, newPageInstance()
>         Class.newInstance() on the given class. This can be overridden by subclassing
>         ClickServlet. However, I believe this functionality should be factored out into
a separate
>         class. A separate page factory would allow page objects to be created in more
>         ways (e.g., from Spring contexts or Tapestry IoC registries) without altering
>         ClickServlet. I
>     Looking at SpringClickServlet there seems to be quite a bit going on in there which
>     deal only with newPageIntance. So with a PageFactory in place, wouldn't Spring still
need to
>     subclass ClickServlet to work?
>     Kind regards
>     Bob

View raw message