Dashboard > WebWork > ... > XWork Configuration > Interceptor Configuration
  WebWork Log In View a printable version of the current page.  
  Interceptor Configuration
Added by Patrick Lightbody, last edited by tm_jee on Jan 01, 2006  (view change)
Labels: 
(None)

Description

Interceptors allow you to define code to be executed before and/or after the execution of an action. Interceptors can be a powerful tool when writing web applications. Some of the most common implementations of an Interceptor might be:

  • Security Checking (ensuring the user is logged in)
  • Trace Logging (logging every action)
  • Bottleneck Checking (start a timer before and after every action, to check bottlenecks in your application)
    You can also chain Interceptors together to create an interceptor stack. If you wanted to do a login check, security check, and logging all before an Action call, this could easily be done with an interceptor package.

Intercepters must first be defined (to give name them) and can be chained together as a stack:

<interceptors>
  <interceptor name="security" class="com.mycompany.security.SecurityInterceptor"/>
  <interceptor-stack name="defaultComponentStack">
    <interceptor-ref name="component"/>
    <interceptor-ref name="defaultStack"/>
  </interceptor-stack>
</interceptors>

To use them in your actions:

<action name="VelocityCounter" class="com.opensymphony.webwork.example.counter.SimpleCounter">
   <result name="success">...</result>
   <interceptor-ref name="defaultComponentStack"/>
</action>

NOTE: Reference name can be either the name of the interceptor or the name of a stack

For more details, see Interceptors reference.

Most of the content here provided by Matt Dowell <matt.dowell@notiva.com>

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