public class ScopedModelDrivenInterceptor extends AbstractInterceptor
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:
Extending the interceptor:
There are no known extension points for this interceptor.Example code:
<-- Basic usage --> <interceptor name="scopedModelDriven" class="org.apache.struts2.interceptor.ScopedModelDrivenInterceptor" /> <-- Using all available parameters --> <interceptor name="gangsterForm" class="org.apache.struts2.interceptor.ScopedModelDrivenInterceptor"> <param name="scope">session</param> <param name="name">gangsterForm</param> <param name="className">com.opensymphony.example.GangsterForm</param> </interceptor>
Constructor and Description |
---|
ScopedModelDrivenInterceptor() |
Modifier and Type | Method and Description |
---|---|
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) |
destroy, init, setDisabled, shouldIntercept
public void setObjectFactory(ObjectFactory factory)
protected Object resolveModel(ObjectFactory factory, ActionContext actionContext, String modelClassName, String modelScope, String modelName) throws Exception
Exception
public String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.public void setClassName(String className)
className
- the className to setpublic void setName(String name)
name
- the name to setpublic void setScope(String scope)
scope
- the scope to setCopyright © 2000–2024 Apache Software Foundation. All rights reserved.