Dashboard > WebWork > ... > Reference > PreResultListener
  WebWork Log In View a printable version of the current page.  
  PreResultListener
Added by tm_jee, last edited by Philip Luppens on Dec 06, 2006  (view change)
Labels: 
(None)

PreResultListener is a little hook that results in a callback being made to it before the actual result is to be executed but after the action invocation took place.

How does it works

  • start request
    • begin of interception 1
      • begin of interception 2
        • action
        • pre-result-listener kicks in
        • execution of result
      • end of interception 2
    • end of interception 1
  • end request

How to add PreResultListener in my code?

Through Interceptor

public class MyInterceptor implements Interceptor {
   ...
   public String intercept(ActionInvocation invocation) throws Exception {
      // we could hook up PreResultListener here
      invocation.addPreResultListener(new PreResultListener() { 
          public void beforeResult(ActionInvocation invocation, String result) {
             ....
          }
      });
   }
   ...
 }

Through Action

public class MyAction extends ActionSupport {
    public String execute() throws Exception {
         ActionContext.getContext().getActionInvocation().addPreResultListener() { 
              new PreResultListener() {
                  public void beforeResult(ActionInvocation invocation, String result) {
                     ....
                  }
              }
         };
    }
 }

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators