|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.cc.framework.adapter.struts.ActionUtil
Utility methods for Action derived classes
Action| Field Summary | |
private static java.lang.String |
ERR_ACTION
Error message |
private static java.lang.String |
ERR_ACTION_CTRL
Error message |
private static java.lang.String |
ERR_ACTION_HANDLER
Error message |
private static java.lang.String |
ERR_FIND_CONTROL
Error message |
private static java.lang.String |
ERR_FORMACTION
Error message |
private static org.apache.commons.logging.Log |
log
Private Logger instance |
| Constructor Summary | |
ActionUtil()
|
|
| Method Summary | |
static void |
applyControlStates(FrameworkAction action,
ActionContext ctx)
Applies the serialized control state from the HTTPRequest to the corresponding control instances. |
static ActionContext |
createActionContext(FrameworkAction action,
org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method is called to create the ActionContext wrapper. |
static void |
doRenderAjaxResponse(FrameworkAction action,
ActionContext ctx,
javax.servlet.jsp.PageContext pageContext)
Renders the AJAX XML response |
static void |
execute(FrameworkAction action,
ActionContext ctx)
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). |
static java.lang.reflect.Method |
getActionHandler(FrameworkAction action,
ControlRequestContext ctx,
java.lang.Object[] params)
Searches the action class for a handler method. |
static Control |
getControlByName(FrameworkAction action,
ActionContext ctx,
java.lang.String name)
The framework has a default pattern where to search a control instance. |
static java.lang.reflect.Method |
getFormHandler(FrameworkAction action,
FormActionContext ctx,
java.lang.String methodName)
Searches the action class for a handler method. |
static ActionContext |
handleControlAction(FrameworkAction action,
ActionContext ctx,
ControlMethodInvocation cmi)
Handles an action which comes from a control on the form an delegates the request to the control. |
static void |
handleControlAction(FrameworkAction action,
ControlActionContext ctx,
java.lang.Object[] params)
Handles an action which comes from a control on the form. |
static ActionContext |
handleFormAction(FrameworkAction action,
ActionContext ctx)
Checks if the request comes from a form button (save, cancel, ...) and delegates the request to the corresponding handler for the button which must be implemented in the (action) subclass. |
static boolean |
isValidFormProperty(java.lang.Object bean,
java.lang.String name)
Checks the given form for a valid property |
static java.util.Locale |
localeFromName(HttpContext context,
java.lang.String localeName)
Gets the Locale Object from a Locale Name |
static java.util.Locale |
localeFromSession(HttpContext context)
Gets the Locale Object for the running session |
static java.lang.String |
localize(HttpContext context,
java.lang.String keyOrString)
Localizes a string depending on the localization settings of the Painter context. |
static java.lang.String |
localize(HttpContext context,
java.lang.String keyOrString,
java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context. |
static java.lang.String |
localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments)
Localizes a string depending on the localization settings of the Painter context. |
static java.lang.String |
localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments,
java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context. |
static java.lang.String |
localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments,
java.util.Locale locale,
boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. |
protected static void |
logControlAction(Control ctrl,
java.lang.reflect.Method handler,
java.lang.Throwable t)
This method logs any exceptions that have occurred during the execution of a control event handler |
static void |
removeFormBean(FrameworkAction action,
ActionContext ctx)
Helper function that removes the form bean which can either be located in the user's session or the request scope. |
static void |
sendAjaxResponse(javax.servlet.http.HttpServlet servlet,
FrameworkAction action,
ActionContext ctx)
This method gets called when the framework needs to render the dirty controls |
static void |
setControlValue(FrameworkAction action,
ActionContext ctx,
ControlValuePath path,
java.lang.String[] value)
This method is called to set a control element value |
static void |
setControlValuesFromRequest(FrameworkAction action,
ActionContext ctx)
This method is called to updates any control element data from request values. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final java.lang.String ERR_ACTION
private static final java.lang.String ERR_ACTION_CTRL
private static final java.lang.String ERR_ACTION_HANDLER
private static final java.lang.String ERR_FORMACTION
private static final java.lang.String ERR_FIND_CONTROL
private static org.apache.commons.logging.Log log
| Constructor Detail |
public ActionUtil()
| Method Detail |
public static boolean isValidFormProperty(java.lang.Object bean,
java.lang.String name)
bean - form beanname - property name
true if the property is valid
public static void removeFormBean(FrameworkAction action,
ActionContext ctx)
action - The Action instancectx - The ActionContext
public static Control getControlByName(FrameworkAction action,
ActionContext ctx,
java.lang.String name)
throws java.lang.Exception
action - The Action instancectx - The ActionContextname - The name of the bean
java.lang.Exception - If an exception occurred
public static ActionContext handleControlAction(FrameworkAction action,
ActionContext ctx,
ControlMethodInvocation cmi)
throws java.lang.Exception
action - The Action instancectx - ActionContextcmi - ControlMethodInvocation
java.lang.Exception - if an exception occurs
public static void handleControlAction(FrameworkAction action,
ControlActionContext ctx,
java.lang.Object[] params)
throws java.lang.Exception
action - The Action instancectx - ControlRequestContextparams - Parameters
java.lang.Exception - if an exception occurs
protected static void logControlAction(Control ctrl,
java.lang.reflect.Method handler,
java.lang.Throwable t)
ctrl - The control instancehandler - The Action handlert - The exception
public static java.lang.reflect.Method getActionHandler(FrameworkAction action,
ControlRequestContext ctx,
java.lang.Object[] params)
action - The Action instancectx - the action contextparams - actual parameters
null when no such
method is defined
public static java.lang.reflect.Method getFormHandler(FrameworkAction action,
FormActionContext ctx,
java.lang.String methodName)
action - The Action instancectx - the action contextmethodName - the name of the method
null when no such
method is defined
public static void setControlValue(FrameworkAction action,
ActionContext ctx,
ControlValuePath path,
java.lang.String[] value)
throws java.lang.Exception
action - The Action instancectx - The ActionContextpath - The Pathname of the valuevalue - The value itself
java.lang.Exception - is thrown when a value could not be set
public static void setControlValuesFromRequest(FrameworkAction action,
ActionContext ctx)
throws java.lang.Exception
ControlValuePath
action - The Action instancectx - The ActionContext
java.lang.Exception - is thrown when a value could not be set
public static ActionContext handleFormAction(FrameworkAction action,
ActionContext ctx)
throws java.lang.Exception
action - The Action instancectx - The ActionContext
java.lang.Exception - If an exception occurred
public static ActionContext createActionContext(FrameworkAction action,
org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
action - The Action instancemapping - Struts Action Mappingform - Struts Action FormservletContext - the servlet contextrequest - HTTPServletRequestresponse - HTTPServletResponse
public static void applyControlStates(FrameworkAction action,
ActionContext ctx)
throws java.lang.Exception
action - The Action instancectx - ActionContext
java.lang.Exception - if an exception occurs
public static void execute(FrameworkAction action,
ActionContext ctx)
throws java.lang.Exception
ActionForward instance describing where and how
control should be forwarded, or null if the response has
already been completed.
action - The Action instancectx - The ActionContext
java.lang.Exception - if an exception occurred
public static void sendAjaxResponse(javax.servlet.http.HttpServlet servlet,
FrameworkAction action,
ActionContext ctx)
throws java.lang.Exception
servlet - the HTTP servletaction - action instancectx - the ActionContext
java.lang.Exception - Indicates an error during rendering
public static void doRenderAjaxResponse(FrameworkAction action,
ActionContext ctx,
javax.servlet.jsp.PageContext pageContext)
throws java.lang.Exception
action - action instancectx - ActionContextpageContext - PageContext
java.lang.Exception - Indicates an error during rendering
public static java.lang.String localize(HttpContext context,
java.lang.String keyOrString)
context - JSP Page ContextkeyOrString - String Literal or Resource Key
public static java.lang.String localize(HttpContext context,
java.lang.String keyOrString,
java.util.Locale locale)
context - JSP Page ContextkeyOrString - String Literal or Resource Keylocale - Locale or null
public static java.lang.String localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments)
context - JSP Page ContextkeyOrString - String Literal or Resource Keyarguments - MessageFormat arguments or null
public static java.lang.String localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments,
java.util.Locale locale)
context - JSP Page ContextkeyOrString - String Literal or Resource Keyarguments - MessageFormat arguments or nulllocale - Locale or null
public static java.lang.String localize(HttpContext context,
java.lang.String keyOrString,
java.lang.Object[] arguments,
java.util.Locale locale,
boolean returnNull)
context - JSP Page ContextkeyOrString - The String literal or resource key.arguments - MessageFormat arguments or nulllocale - Locale or nullreturnNull - controls whether to return null or a not present indicator
public static java.util.Locale localeFromName(HttpContext context,
java.lang.String localeName)
context - JSP Page ContextlocaleName - The Name
nullpublic static java.util.Locale localeFromSession(HttpContext context)
context - JSP Page Context
null
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||