|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectInternalUtils
public class InternalUtils
Field Summary |
---|
Constructor Summary | |
---|---|
InternalUtils()
|
Method Summary | |
---|---|
static void |
addActionError(String propertyName,
ActionMessage error,
ServletRequest request)
|
static void |
addActionOutputs(Map toAdd,
ServletRequest request,
boolean overwrite)
|
static void |
addBindingUpdateError(ServletRequest request,
String expression,
String message,
Throwable cause)
Add a BindingUpdateError to the request. |
static String |
addParam(String url,
String paramName,
String paramVal)
Add a parameter to the given URL. |
static boolean |
avoidDirectResponseOutput(ServletRequest request)
Tell whether a special request attribute was set, indicating that we should avoid writing to the response (or setting response error codes). |
static ActionForm |
createActionForm(ActionMapping mapping,
ModuleConfig moduleConfig,
ActionServlet actionServlet,
ServletContext servletContext)
|
static String |
createActionPath(ServletRequest request,
String qualifiedAction)
|
static String |
createActionURL(HttpServletRequest servletRequest,
String qualifiedAction)
|
static ModuleConfig |
ensureModuleConfig(String modulePath,
ServletRequest request,
ServletContext context)
Get the Struts ModuleConfig for the given module path. |
static ActionConfig |
findActionConfig(String actionConfigPath,
String modulePath,
ServletContext context)
Get the Struts ActionConfig for the given action config path and module path. |
static String |
getActionMappingName(String action)
Return the form action converted into an action mapping path. |
static String |
getActionMappingPath(ServletRequest request)
Get the Struts ActionMapping path from the ActionMapping that is in the request under the key Globals.MAPPING_KEY. |
static String |
getActionName(ActionMapping mapping)
|
static Map |
getActionOutputMap(ServletRequest request,
boolean createIfNotExist)
|
static ActionServlet |
getActionServlet(ServletContext context)
Get the current ActionServlet. |
static Map |
getBindingUpdateErrors(ServletRequest request)
Get a map of BindingUpdateErrors stored in the request. |
static String |
getCleanActionName(String action,
boolean prependSlash)
|
static ActionForm |
getCurrentActionForm(ServletRequest request)
|
static ActionMapping |
getCurrentActionMapping(ServletRequest request)
|
static String |
getDecodedServletPath(HttpServletRequest request)
|
static String |
getDecodedURI(HttpServletRequest request)
|
static FacesBackingBean |
getFacesBackingBean(ServletRequest request)
|
static String |
getFlowControllerClassName(ModuleConfig mc)
|
static String |
getFlowControllerClassName(String modulePath,
ServletRequest request,
ServletContext context)
|
static ActionForm |
getFormBean(ActionMapping mapping,
ServletRequest request)
|
static String |
getFormBeanType(FormBeanConfig formBeanConfig)
|
static ActionForm |
getForwardedFormBean(ServletRequest request,
boolean removeFromRequest)
|
static String |
getForwardingModule(ServletRequest request)
Set the module prefix for the ModuleConfig that is performing a forward in this request. |
static HttpSession |
getHttpSession(ServletRequest request,
boolean create)
|
static String |
getLongLivedFlowAttr(String modulePath)
|
static ModuleConfig |
getModuleConfig(String modulePath,
ServletContext context)
Get the Struts ModuleConfig for the given module path. |
static String |
getModulePathFromReqAttr(HttpServletRequest request)
Gets the Struts module path from the input request. |
static PageflowConfig.MultipartHandler.Enum |
getMultipartHandlerType()
|
static Map |
getPageInputMap(ServletRequest request)
|
static Class |
getReloadableClass(String className,
ServletContext servletContext)
|
static ServletContext |
getServletContext(ServletRequest req)
|
static String |
getSharedFlowClassName(HttpServletRequest request,
ServletContext servletContext)
|
static String |
getSharedFlowClassNameForRelativeURI(String relativeURI,
ServletRequest request,
ServletContext servletContext)
|
static boolean |
ignoreIncludeServletPath(ServletRequest request)
|
static String |
inferModulePathFromClassName(String className)
|
static boolean |
isLongLived(ModuleConfig moduleConfig)
Tell whether the given module is a long-lived page flow. |
static boolean |
isMultipartHandlingEnabled(ServletRequest request)
|
static boolean |
isNestable(ModuleConfig moduleConfig)
Tell whether the given module is a nested page flow. |
static boolean |
isSessionScope(ActionMapping mapping)
|
static boolean |
isSharedFlowModule(ModuleConfig mc)
|
static Method |
lookupMethod(Class parentClass,
String methodName,
Class[] signature)
Get a Method in a Class. |
static Object |
newReloadableInstance(String className,
ServletContext servletContext)
|
static String |
qualifyAction(ServletContext servletContext,
String action)
|
static void |
removeCurrentPageFlow(HttpServletRequest request)
|
static void |
sendDevTimeError(String messageKey,
Object[] messageArgs,
Throwable cause,
int productionTimeErrorCode,
ServletRequest request,
ServletResponse response,
ServletContext servletContext)
If not in production mode, write an error to the response; otherwise, set a response error code. |
static void |
sendDevTimeError(String messageKey,
Throwable cause,
int productionTimeErrorCode,
ServletRequest request,
ServletResponse response,
ServletContext servletContext,
Object... messageArgs)
If not in production mode, write an error to the response; otherwise, set a response error code. |
static void |
sendError(String messageKey,
Object[] messageArgs,
ServletRequest request,
ServletResponse response,
Throwable cause,
boolean avoidDirectResponseOutput)
Write an error to the response. |
static void |
sendError(String messageKey,
Throwable cause,
ServletRequest request,
HttpServletResponse response,
Object... messageArgs)
Write an error to the response. |
static boolean |
sessionExpired(ServletRequest servletRequest)
|
static void |
setAvoidDirectResponseOutput(ServletRequest request)
Set a special request attribute to indicate that we should avoid writing to the response (or setting response error codes). |
static void |
setCurrentActionResolver(ActionResolver resolver,
HttpServletRequest request)
Set the current ActionResolver ( PageFlowController ) in the user session. |
static void |
setCurrentModule(ModuleConfig mc,
ServletRequest request)
|
static void |
setCurrentPageFlow(PageFlowController jpf,
HttpServletRequest request)
|
static void |
setFormInScope(String formName,
ActionForm form,
ActionMapping mapping,
HttpServletRequest request,
boolean overwrite)
Set the given form in either the request or session, as appropriate, so Struts/NetUI tags will have access to it. |
static void |
setForwardedFormBean(ServletRequest request,
ActionForm form)
Set the forwarded form. |
static void |
setForwardingModule(ServletRequest request,
String modulePrefix)
Set the module prefix for the ModuleConfig that is performing a forward in this request. |
static void |
setIgnoreIncludeServletPath(ServletRequest request,
boolean ignore)
Tell getDecodedServletPath(javax.servlet.http.HttpServletRequest) (and all that call it) to ignore the attribute that specifies the Servlet
Include path, which is set when a Servlet include is done through RequestDispatcher. |
static void |
setServletContext(ServletRequest request,
ServletContext servletContext)
|
static void |
throwPageFlowException(PageFlowException ex)
|
static void |
throwPageFlowException(PageFlowException effect,
ServletRequest request)
|
static Object |
unwrapFormBean(ActionForm form)
We unwrap two special form types: XmlBeanActionForm and AnyBeanActionForm. |
static ServletRequest |
unwrapMultipart(ServletRequest request)
If the given request is a MultipartRequestWrapper (Struts class that doesn't extend HttpServletRequestWrapper), return the wrapped request; otherwise, return the given request. |
static ActionForm |
wrapFormBean(Object formBean)
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InternalUtils()
Method Detail |
---|
public static void sendDevTimeError(String messageKey, Throwable cause, int productionTimeErrorCode, ServletRequest request, ServletResponse response, ServletContext servletContext, Object... messageArgs) throws IOException
IOException
public static void sendDevTimeError(String messageKey, Object[] messageArgs, Throwable cause, int productionTimeErrorCode, ServletRequest request, ServletResponse response, ServletContext servletContext) throws IOException
IOException
public static void sendError(String messageKey, Throwable cause, ServletRequest request, HttpServletResponse response, Object... messageArgs) throws IOException
IOException
public static void sendError(String messageKey, Object[] messageArgs, ServletRequest request, ServletResponse response, Throwable cause, boolean avoidDirectResponseOutput) throws IOException
IOException
public static Object unwrapFormBean(ActionForm form)
public static ActionForm wrapFormBean(Object formBean)
public static Method lookupMethod(Class parentClass, String methodName, Class[] signature)
parentClass
- the Class in which to find the Method.methodName
- the name of the Method.signature
- the argument types for the Method.
null
if the method does not exist.public static String getFlowControllerClassName(String modulePath, ServletRequest request, ServletContext context)
public static String getFlowControllerClassName(ModuleConfig mc)
public static boolean isLongLived(ModuleConfig moduleConfig)
public static boolean isNestable(ModuleConfig moduleConfig)
public static String getLongLivedFlowAttr(String modulePath)
public static void setCurrentPageFlow(PageFlowController jpf, HttpServletRequest request)
public static void removeCurrentPageFlow(HttpServletRequest request)
public static String getDecodedURI(HttpServletRequest request)
public static String getDecodedServletPath(HttpServletRequest request)
public static void addActionOutputs(Map toAdd, ServletRequest request, boolean overwrite)
public static void addActionError(String propertyName, ActionMessage error, ServletRequest request)
public static Object newReloadableInstance(String className, ServletContext servletContext) throws ClassNotFoundException, InstantiationException, IllegalAccessException
ClassNotFoundException
InstantiationException
IllegalAccessException
public static Class getReloadableClass(String className, ServletContext servletContext) throws ClassNotFoundException
ClassNotFoundException
public static Map getActionOutputMap(ServletRequest request, boolean createIfNotExist)
public static Map getPageInputMap(ServletRequest request)
public static ModuleConfig getModuleConfig(String modulePath, ServletContext context)
public static ModuleConfig ensureModuleConfig(String modulePath, ServletRequest request, ServletContext context)
public static ActionServlet getActionServlet(ServletContext context)
context
- the current ServletContext
public static void addBindingUpdateError(ServletRequest request, String expression, String message, Throwable cause)
request
- the current ServletRequest.expression
- the expression associated with this error.message
- the error message.cause
- the Throwable that caused the error.public static Map getBindingUpdateErrors(ServletRequest request)
public static void setCurrentModule(ModuleConfig mc, ServletRequest request)
public static ActionForm createActionForm(ActionMapping mapping, ModuleConfig moduleConfig, ActionServlet actionServlet, ServletContext servletContext)
public static void setFormInScope(String formName, ActionForm form, ActionMapping mapping, HttpServletRequest request, boolean overwrite)
public static boolean isSessionScope(ActionMapping mapping)
public static ActionForm getFormBean(ActionMapping mapping, ServletRequest request)
public static void setCurrentActionResolver(ActionResolver resolver, HttpServletRequest request)
PageFlowController
) in the user session.
resolver
- the ActionResolver to set as the current one in the user session.request
- the current HttpServletRequest.public static String getSharedFlowClassName(HttpServletRequest request, ServletContext servletContext)
public static String getSharedFlowClassNameForRelativeURI(String relativeURI, ServletRequest request, ServletContext servletContext)
public static boolean isSharedFlowModule(ModuleConfig mc)
public static FacesBackingBean getFacesBackingBean(ServletRequest request)
public static String inferModulePathFromClassName(String className)
public static boolean isMultipartHandlingEnabled(ServletRequest request)
public static PageflowConfig.MultipartHandler.Enum getMultipartHandlerType()
public static void setServletContext(ServletRequest request, ServletContext servletContext)
public static ServletContext getServletContext(ServletRequest req)
public static HttpSession getHttpSession(ServletRequest request, boolean create)
public static String createActionURL(HttpServletRequest servletRequest, String qualifiedAction)
public static String createActionPath(ServletRequest request, String qualifiedAction)
public static String qualifyAction(ServletContext servletContext, String action)
public static String getActionMappingName(String action)
action
property is manipulated as follows in
computing the name of the requested mapping:
action
- the action name to be converted.
public static String getCleanActionName(String action, boolean prependSlash)
public static String addParam(String url, String paramName, String paramVal)
url
- the URL to which to append.paramName
- the name of the parameter to add.paramVal
- the value of the parameter to add.
public static String getActionName(ActionMapping mapping)
public static ActionMapping getCurrentActionMapping(ServletRequest request)
public static ActionForm getCurrentActionForm(ServletRequest request)
public static boolean sessionExpired(ServletRequest servletRequest)
public static void throwPageFlowException(PageFlowException ex)
public static void throwPageFlowException(PageFlowException effect, ServletRequest request) throws PageFlowException
PageFlowException
public static ActionConfig findActionConfig(String actionConfigPath, String modulePath, ServletContext context)
public static String getActionMappingPath(ServletRequest request)
public static String getModulePathFromReqAttr(HttpServletRequest request)
public static void setForwardedFormBean(ServletRequest request, ActionForm form)
public static ActionForm getForwardedFormBean(ServletRequest request, boolean removeFromRequest)
public static boolean avoidDirectResponseOutput(ServletRequest request)
public static void setAvoidDirectResponseOutput(ServletRequest request)
public static void setForwardingModule(ServletRequest request, String modulePrefix)
public static String getForwardingModule(ServletRequest request)
public static String getFormBeanType(FormBeanConfig formBeanConfig)
public static void setIgnoreIncludeServletPath(ServletRequest request, boolean ignore)
getDecodedServletPath(javax.servlet.http.HttpServletRequest)
(and all that call it) to ignore the attribute that specifies the Servlet
Include path, which is set when a Servlet include is done through RequestDispatcher. Normally,
getDecodedServletPath tries the Servlet Include path before falling back to getServletPath() on the request.
Note that this is basically a stack of instructions to ignore the include path, and this method expects each
call with ignore
==true
to be balanced by a call with
ignore
==false
.
public static boolean ignoreIncludeServletPath(ServletRequest request)
public static ServletRequest unwrapMultipart(ServletRequest request)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |