click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Edgar (JIRA)" <>
Subject [jira] Commented: (CLK-598) Provide Page Listener / Interceptor facility
Date Tue, 29 Dec 2009 03:08:29 GMT


Malcolm Edgar commented on CLK-598:

OK with PageInterceptor for a name. This will also help differentiate the concept for control

> Provide Page Listener / Interceptor facility
> --------------------------------------------
>                 Key: CLK-598
>                 URL:
>             Project: Click
>          Issue Type: New Feature
>          Components: core
>            Reporter: Malcolm Edgar
>             Fix For: 2.2.0
> Provide an application page listener / interceptor facility into Click.  The concept
is to provide an extension point for code which can listener to key page events and also interrupt
normal page processing flow.
> Using this code which tends to be incorporated into Page superclasses can be refactored
into listener classes which can be reused in applications. This approach supports Page design
by composition, rather than through inheritance.
> Page listeners could be used for:
> * enforcing an application wide security polity, rather than using the Page#onSecurityCheck()
> * dependency injection, see CLK-581
> * support page performance profiling and logging
> The listener interface would be:
> public interface PageListener {
>        boolean pageCreate(Class<? extends Page> pageClass, Context context);
>        boolean postCreate(Page page);
>        boolean preResponse(Page page);
>        void postDestroy(Page page);
> }
> Application page listeners classes would be defined in the click.xml configuration file.
Applications could defined multiple listeners which would be executed sequentially in the
order in which there are defined.  Listeners could have a scope /  lifecycle of request (where
by new instances are created for each page request, and are threadsafe), or application (where
by a single instance is created and used for all page requests).  Listener can also be configured
to have properties which are set after creation.  This scope rules equates to Spring prototype
and singleton scopes.
> An example configuration is provided below:
>     <page-listener classname="com.mycorp.listener.PageProfilerListener/>
>     <page-listener classname="com.mycorp.listener.SecurityPageListener" scope="application">
>         <property name="notAthenticatedPath" value="/login.htm"/>
>         <property name="notAuthorizedPath" value="/not-authorized.htm"/>
>     </page-listener>

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message