Class FormRetrieveInterceptor
java.lang.Object
org.apache.struts2.interceptor.AbstractInterceptor
com.opensymphony.xwork2.interceptor.AbstractInterceptor
name.matthewgreet.strutscommons.interceptor.FormRetrieveInterceptor
- All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.ConditionalInterceptor
,com.opensymphony.xwork2.interceptor.Interceptor
,Serializable
,org.apache.struts2.interceptor.ConditionalInterceptor
,org.apache.struts2.interceptor.Interceptor
public class FormRetrieveInterceptor
extends com.opensymphony.xwork2.interceptor.AbstractInterceptor
Retrieves a form stored in the session by FormStoreInterceptor
and injects it into the action's member
variable configured by the Form
annotation to accept it. It is usually part of the ViewStack interceptor
stack so a view action can display rejected form data.
Interceptor parameters
- disabled
- If true, all processing is disabled. This is useful for standalone popup windows, especially self-refreshing ones, that never display messages. Defaults to false.
Extending the interceptor
The following method could be overridden :-
- fieldReceives
- Whether Struts action member variable can be set to the stored form.
Example code
@InterceptorRefs({ @InterceptorRef(value="formRetrieve"), @InterceptorRef(value="basicStack") })
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opensymphony.xwork2.interceptor.ConditionalInterceptor
com.opensymphony.xwork2.interceptor.ConditionalInterceptor.LegacyAdapter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addConversionErrors
(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) Adds stored conversion errors.protected void
Deletes stored form as unused.protected boolean
fieldReceives
(Class<?> actionClass, Field field, FormStoreInterceptor.StoredForm storedForm) Returns whether Struts action member variable can be set to the stored form, which is whether the member variable's type is compatible with the form andForm.reception()
annotation settings accept form validation status.boolean
Returns whether Action will not retrieve forms.protected void
injectForm
(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) Injects form into specific field.intercept
(com.opensymphony.xwork2.ActionInvocation invocation) protected void
restoreForm
(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm) Injects stored form into receiving field of current action and pushes conversion errors onto the Value Stack.void
setDisabled
(boolean value) Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
intercept, shouldIntercept, shouldIntercept
Methods inherited from class org.apache.struts2.interceptor.AbstractInterceptor
destroy, init, setDisabled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.struts2.interceptor.Interceptor
destroy, init
-
Constructor Details
-
FormRetrieveInterceptor
public FormRetrieveInterceptor()
-
-
Method Details
-
addConversionErrors
protected void addConversionErrors(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) throws Exception Adds stored conversion errors.- Throws:
Exception
-
deleteStoredForm
protected void deleteStoredForm()Deletes stored form as unused. -
fieldReceives
protected boolean fieldReceives(Class<?> actionClass, Field field, FormStoreInterceptor.StoredForm storedForm) Returns whether Struts action member variable can be set to the stored form, which is whether the member variable's type is compatible with the form andForm.reception()
annotation settings accept form validation status. -
injectForm
protected void injectForm(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm, Field field) throws Exception Injects form into specific field.- Throws:
Exception
-
restoreForm
protected void restoreForm(com.opensymphony.xwork2.ActionInvocation invocation, FormStoreInterceptor.StoredForm storedForm) Injects stored form into receiving field of current action and pushes conversion errors onto the Value Stack. -
getDisabled
public boolean getDisabled()Returns whether Action will not retrieve forms. -
setDisabled
public void setDisabled(boolean value) -
intercept
- Specified by:
intercept
in interfacecom.opensymphony.xwork2.interceptor.Interceptor
- Specified by:
intercept
in classcom.opensymphony.xwork2.interceptor.AbstractInterceptor
- Throws:
Exception
-