public class PreparableInterceptor extends BaseActionInterceptor
prepare() before action method invocation.
A typical use of this is to run some logic to load an object from the database, so that when parameters are set they can be set on this object. For example, suppose you have a User object with two properties: id and name. Provided that the params interceptor is called twice (once before and once after this interceptor), you can load the User object using the id property, and then when the second params interceptor is called the parameter user.name will be set, as desired, on the actual object loaded from the database.
Optionally, preparable interceptor injects request parameters that ends with ".id" or "Id" so you can immediately load objects from storage before preparing.
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String[] |
ATTR_NAME_ID_SUFFIXES |
protected boolean |
isInjectIdsFromRequestEnabled |
protected MadvocConfig |
madvocConfig |
protected RequestScopeInjector |
requestInjector |
protected ScopeDataResolver |
scopeDataResolver |
enabled| Constructor and Description |
|---|
PreparableInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Initializes wrapper once everything is injected.
|
protected void |
injectIdsFromRequest(ActionRequest actionRequest)
Injects IDs from request.
|
java.lang.Object |
intercept(ActionRequest actionRequest)
Intercepts action requests.
|
boolean |
isInjectIdsFromRequestEnabled() |
void |
setInjectIdsFromRequestEnabled(boolean isInjectIdsFromRequestEnabled) |
invoke, toStringisEnabled, setEnabledclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisEnabled, setEnabledprotected static final java.lang.String[] ATTR_NAME_ID_SUFFIXES
@In(scope=CONTEXT) protected MadvocConfig madvocConfig
@In(scope=CONTEXT) protected ScopeDataResolver scopeDataResolver
protected RequestScopeInjector requestInjector
protected boolean isInjectIdsFromRequestEnabled
public void init()
BaseActionWrapperinit in interface ActionWrapperinit in class BaseActionWrapperpublic boolean isInjectIdsFromRequestEnabled()
public void setInjectIdsFromRequestEnabled(boolean isInjectIdsFromRequestEnabled)
public java.lang.Object intercept(ActionRequest actionRequest) throws java.lang.Exception
java.lang.Exceptionprotected void injectIdsFromRequest(ActionRequest actionRequest)
Copyright © 2003-2013 Jodd Team