public abstract class WebAction extends ActionBase implements Disposable, ExceptionAware, ActionAccessValidator, ActionErrorProvider, com.opensymphony.xwork2.TextProvider
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ITEM_PROPERTY_NAME |
protected static org.slf4j.Logger |
log |
static String |
PORTLET_ACTION_RESULT |
EXITCODE_ERROR, EXITCODE_SUCCESS
Constructor and Description |
---|
WebAction() |
Modifier and Type | Method and Description |
---|---|
protected void |
addFieldError(String name,
Column column,
ErrorInfo error) |
protected void |
addItemError(String item,
ErrorType errorType,
String title,
ErrorInfo error) |
void |
clearActionErrors()
clears the action error (if any) and all item errors
|
void |
clearItem() |
int |
dispose()
Cleanup resources allocated by the action
this requires the action to be stored on the request in a param named "action"
the ActionBasicsInterceptor performs this task
the dispose method will then be called from the EmpireStrutsDispatcher
|
protected String |
getActionParam(String name) |
String |
getActionURL(String action,
Map<String,Object> parameters)
Deprecated.
|
protected Connection |
getConnection() |
String |
getItem() |
Map<String,ErrorInfo> |
getItemErrors()
returns a map of field errors
field errors are not persisted on the session and will be lost on redirects.
|
protected Object[] |
getItemKey() |
protected boolean |
getItemNewFlag() |
String |
getItemPropertyName()
returns the name of the parameter used to get and set the action's item
This function is used by the jsp tags as default parameter name of the item attribute
By default this ist the name "item"
|
ErrorInfo |
getLastActionError(boolean clear)
returns the last Action Error of the current or a previous action
the error is left on the session unless the clear flag is set to true
In order to display the error to the user an application should use
this function instead of getActionError() and set clear to true.
|
String |
getLastActionMessage(boolean clear)
returns the last set Action Message
the message is left on the session unless the clear flag is set to true
|
int |
getListPageSize() |
Locale |
getLocale() |
String |
getLocalizedErrorMessage(ErrorInfo error)
return the localized message for an error
|
String[] |
getRequestArrayParam(String param) |
Integer |
getRequestIntParam(String param) |
String |
getRequestParam(String param) |
Map<String,Object> |
getRequestParameters() |
String |
getText(String aTextName) |
String |
getText(String aTextName,
List<Object> args) |
String |
getText(String aTextName,
String defaultValue) |
String |
getText(String key,
String[] args) |
String |
getText(String aTextName,
String defaultValue,
List<Object> args) |
String |
getText(String key,
String defaultValue,
List<Object> args,
com.opensymphony.xwork2.util.ValueStack stack) |
String |
getText(String aTextName,
String defaultValue,
String obj) |
String |
getText(String key,
String defaultValue,
String[] args) |
String |
getText(String key,
String defaultValue,
String[] args,
com.opensymphony.xwork2.util.ValueStack stack) |
ResourceBundle |
getTexts() |
ResourceBundle |
getTexts(String aBundleName) |
String |
handleException(Throwable exception,
String method)
handle any exception that may have occurred
The method is called from the ActionBasicsInterceptor
|
boolean |
hasAccess(String method)
Determines whether the user has access to this page or a particular method
The method is called from the ActionAccessInterceptor
|
boolean |
hasActionError()
returns true if the current action has either an action or a field error
WARNING: this function returns false if a previous action had an error
|
protected boolean |
hasItem(boolean lookOnSession) |
boolean |
hasKey(String key) |
boolean |
hasRequestParam(String param) |
void |
init()
Initialize the action
Should be used instead of the constructor to initialize the action
The method is called from the ActionBasicsInterceptor
|
boolean |
isNewItem() |
boolean |
loginRequired()
Determines whether the user needs to Login to access this page
important: return false if the user has already logged in!
|
void |
putRequestParam(String name,
String value) |
String |
renderPortlet() |
protected void |
setActionError(ErrorInfo error) |
protected void |
setActionError(ErrorType errType) |
protected void |
setActionError(ErrorType errType,
String param) |
void |
setActionError(Exception exception) |
protected void |
setActionMessage(String message) |
void |
setItem(String value) |
getActionBean, getActionBean, getActionBeanName, getActionObject, getActionObjectName, getRecordKeyExpr, getRecordKeyFromString, getRecordKeyString, getRecordKeyString, getRecordNewFlagFromString, putActionBean, putActionBean, putActionObject, removeActionBean, removeActionBean, removeActionObject
protected static org.slf4j.Logger log
public static String DEFAULT_ITEM_PROPERTY_NAME
public static String PORTLET_ACTION_RESULT
public void init()
init
in interface Disposable
public int dispose()
dispose
in interface Disposable
public String handleException(Throwable exception, String method)
handleException
in interface ExceptionAware
exception
- the exception that occurredpublic boolean loginRequired()
loginRequired
in interface ActionAccessValidator
public boolean hasAccess(String method)
hasAccess
in interface ActionAccessValidator
public boolean hasActionError()
ActionErrorProvider
hasActionError
in interface ActionErrorProvider
public void clearActionErrors()
ActionErrorProvider
clearActionErrors
in interface ActionErrorProvider
public ErrorInfo getLastActionError(boolean clear)
ActionErrorProvider
getLastActionError
in interface ActionErrorProvider
clear
- flag that determines whether to remove this error from the session or notpublic String getLocalizedErrorMessage(ErrorInfo error)
ActionErrorProvider
getLocalizedErrorMessage
in interface ActionErrorProvider
error
- the error infoprotected void setActionError(ErrorInfo error)
protected final void setActionError(ErrorType errType)
public final void setActionError(Exception exception)
setActionError
in class ActionBase
public Map<String,ErrorInfo> getItemErrors()
ActionErrorProvider
getItemErrors
in interface ActionErrorProvider
protected void addItemError(String item, ErrorType errorType, String title, ErrorInfo error)
protected void addFieldError(String name, Column column, ErrorInfo error)
addFieldError
in class ActionBase
public String getLastActionMessage(boolean clear)
ActionErrorProvider
getLastActionMessage
in interface ActionErrorProvider
clear
- if true will clear the message from the sessionprotected void setActionMessage(String message)
public Locale getLocale()
getLocale
in interface com.opensymphony.xwork2.LocaleProvider
public boolean hasKey(String key)
hasKey
in interface com.opensymphony.xwork2.TextProvider
public String getText(String aTextName)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String aTextName, String defaultValue)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String aTextName, String defaultValue, String obj)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String aTextName, List<Object> args)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String key, String[] args)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String aTextName, String defaultValue, List<Object> args)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String key, String defaultValue, String[] args)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String key, String defaultValue, List<Object> args, com.opensymphony.xwork2.util.ValueStack stack)
getText
in interface com.opensymphony.xwork2.TextProvider
public String getText(String key, String defaultValue, String[] args, com.opensymphony.xwork2.util.ValueStack stack)
getText
in interface com.opensymphony.xwork2.TextProvider
public ResourceBundle getTexts()
getTexts
in interface com.opensymphony.xwork2.TextProvider
public ResourceBundle getTexts(String aBundleName)
getTexts
in interface com.opensymphony.xwork2.TextProvider
public int getListPageSize()
getListPageSize
in class ActionBase
protected Connection getConnection()
getConnection
in class ActionBase
public String getItemPropertyName()
ActionItemProperty
getItemPropertyName
in interface ActionItemProperty
public String getItem()
public void setItem(String value)
public void clearItem()
public boolean isNewItem()
protected final boolean hasItem(boolean lookOnSession)
protected final Object[] getItemKey()
protected final boolean getItemNewFlag()
public final Map<String,Object> getRequestParameters()
getRequestParameters
in interface RequestParamProvider
public final boolean hasRequestParam(String param)
hasRequestParam
in interface RequestParamProvider
public final String getRequestParam(String param)
getRequestParam
in interface RequestParamProvider
public final String[] getRequestArrayParam(String param)
getRequestArrayParam
in interface RequestParamProvider
@Deprecated public String getActionURL(String action, Map<String,Object> parameters)
public String renderPortlet()
Copyright © 2008–2022 Apache Software Foundation. All rights reserved.