Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2.interceptor
Class ScopedModelDrivenInterceptor

    java.lang.Object
      com.opensymphony.xwork2.interceptor.AbstractInterceptor
          com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor

All Implemented Interfaces:
  Interceptor, Serializable

    public class ScopedModelDrivenInterceptor

extends AbstractInterceptor

An interceptor that enables scoped model-driven actions.

This interceptor only activates on actions that implement the `ScopedModelDriven` interface. If detected, it will retrieve the model class from the configured scope, then provide it to the Action.

Interceptor parameters:

- className - The model class name. Defaults to the class name of the object returned by the getModel() method.
- name - The key to use when storing or retrieving the instance in a scope. Defaults to the model class name.
- scope - The scope to store and retrieve the model. Defaults to 'request' but can also be 'session'.

Extending the interceptor:

There are no known extension points for this interceptor.

Example code:

     <-- Basic usage -->
     <interceptor name="scoped-model-driven" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor" />

     <-- Using all available parameters -->
     <interceptor name="gangsterForm" class="com.opensymphony.interceptor.ScopedModelDrivenInterceptor">
          <param name="scope">session</param>
          <param name="name">gangsterForm</param>
          <param name="className">com.opensymphony.example.GangsterForm</param>
      </interceptor>

See Also:
  Serialized Form

Field Summary
`private String` | `className`
`private static String` | `GET_MODEL`
`private String` | `name`
`private ObjectFactory` | `objectFactory`
`private String` | `scope`

Constructor Summary
`ScopedModelDrivenInterceptor()`

Method Summary
`String` | `intercept(ActionInvocation invocation)` Override to handle interception
`protected Object` | `resolveModel(ObjectFactory factory, ActionContext actionContext, String modelClassName, String modelScope, String modelName)`
`void` | `setClassName(String className)`
`void` | `setName(String name)`
`void` | `setObjectFactory(ObjectFactory factory)`
`void` | `setScope(String scope)`

Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
`destroy, init`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### GET_MODEL

    private static final String GET_MODEL

See Also:
  Constant Field Values

### scope

    private String scope

### name

    private String name

### className

    private String className

### objectFactory

    private ObjectFactory objectFactory

Constructor Detail

### ScopedModelDrivenInterceptor

    public ScopedModelDrivenInterceptor()

Method Detail

### setObjectFactory

    public void setObjectFactory(ObjectFactory factory)

### resolveModel

    protected Object resolveModel(ObjectFactory factory,
                                  ActionContext actionContext,
                                  String modelClassName,
                                  String modelScope,
                                  String modelName)
                           throws Exception

  Throws:
    `Exception`

### intercept

    public String intercept(ActionInvocation invocation)
                     throws Exception

  Description copied from class: `AbstractInterceptor`
  Override to handle interception

  Specified by:
    `intercept` in interface `Interceptor`
  Specified by:
    `intercept` in class `AbstractInterceptor`
  Returns:
    the return code, either returned from `ActionInvocation.invoke()`, or from the interceptor itself.
  Throws:
    `Exception` - any system-level error, as defined in `Action.execute()`.

### setClassName

    public void setClassName(String className)

  Parameters:
    `className` - the className to set

### setName

    public void setName(String name)

  Parameters:
    `name` - the name to set

### setScope

    public void setScope(String scope)

  Parameters:
    `scope` - the scope to set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.