Dmitry,
   there is the import
org.apache.tapestry5.services.ComponentRequestFilter, which gets called on
page and component events. For example, Tynamo's tapestry-security module
(e.g. org.tynamo.security.SecurityComponentRequestFilter) uses these to
check if the user has the correct permissions.

   Maybe this is too obvious of an answer and you're looking for something
else...

Cheers,

Alex K

On Mon, Aug 6, 2012 at 3:52 PM, Dmitry Gusev <dmitry.gu...@gmail.com> wrote:

> Hi,
>
> is it possible to intercept component event actions?
>
> I have one page with multiple zones. Blocks from another page rendered on
> these zones using ajax.
> Those blocks have components with event action handlers.
> Every action handler have context parameter, and I would like to check
> these params before action gets executed and, possibly, substitute another
> action output.
>
> Normally I'd use page's onActivate method for this, but since blocks are on
> the other page -- onActivate doesn't get invoked for that page.
> Now I have to repeat the code in order to do checks (see code below), but
> I'd really like to intercept these calls.
>
> Just can't find how to do this. Or I'm I doing something wrong and this can
> be done in some other way?
>
> public class PageWithBlocks {
>
>     private Project project;
>
>     ...
>
>     public Object onActionFromCheckout(int projectId) {
>         //  XXX Code smells (DRY)
>         if (project == null)
>         {
>             Object response = resolveProject(projectId);
>             if (project == null) {
>                 return response;
>             }
>         }
>
>         projectManager.scheduleCheckout(project);
>
>         return settingsBlock;
>     }
>
>     public Object onActionFromUpdate(int projectId) {
>         //  XXX Code smells (DRY)
>         if (project == null)
>         {
>             Object response = resolveProject(projectId);
>             if (project == null) {
>                 return response;
>             }
>         }
>
>         projectManager.scheduleUpdate(project);
>
>         return settingsBlock;
>     }
> }
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>

Reply via email to