Class ConfigHelper
- All Implemented Interfaces:
ConfigHelperInterface
NOTE: THIS CLASS IS UNDER ACTIVE DEVELOPMENT. THE CURRENT CODE IS WRITTEN FOR CLARITY NOT EFFICIENCY. NOT EVERY API FUNCTION HAS BEEN IMPLEMENTED YET.
A helper object to expose the Struts shared resources, which are be stored in the application, session, or request contexts, as appropriate.
An instance should be created for each request processed. The methods which return resources from the request or session contexts are not thread-safe.
Provided for use by other servlets in the application so they can easily access the Struts shared resources.
The resources are stored under attributes in the application, session, or request contexts.
The ActionConfig methods simply return the resources from under the context and key used by the Struts ActionServlet when the resources are created.
- Since:
- Struts 1.1
- Version:
- $Rev$ $Date: 2005-05-14 02:09:06 -0400 (Sat, 14 May 2005) $
-
Constructor Summary
ConstructorsConstructorDescriptionConfigHelper(ServletContext application, HttpServletRequest request, HttpServletResponse response) -
Method Summary
Modifier and TypeMethodDescriptionWrapper for getAction(String)Return the URL for the specified ActionMapping, otherwise returnnull.Retrieve and return theActionFormbean associated with this mapping, creating and stashing one if necessary.getActionForward(String name) Return the forwarding associated with the specified logical name, if any; otherwise returnnull.getActionMapping(String path) Return the mapping associated with the specified request path, if any; otherwise returnnull.getActionMappingName(String action) Return the form action converted into an action mapping path.getActionMappingURL(String action) Return the form action converted into a server-relative URL.Theorg.apache.struts.action.ActionFormBeanscollection for this application.Renders the reference for a HTMLelement. getEncodeURL(String url) Return the url encoded to maintain the user session, if any.The runtime JspException that may be been thrown by a Struts tag extension, or compatible presentation extension, and placed in the request.getFormBean(String name) Return the form bean definition associated with the specified logical name, if any; otherwise returnnull.Return the path for the specified forward, otherwise returnnull.Theorg.apache.struts.ActionMappinginstance for this request.getMessage(String key) Return the localized message for the specified key, otherwise returnnull.getMessage(String key, Object[] args) Look up and return a message string, based on the specified parameters.The application resources for this application.The multipart object for this request.Renders the reference for a HTML <base> elementThe path-mapped pattern (/action/*) or extension mapped pattern ((*.do) used to determine our Action URIs in this application.getToken()The transaction token stored in this session, if it is used.booleanReturn true if a message string for the specified message key is present for the user's Locale.Wrapper for getLink(String)Wrapper for getMessage(String)Wrapper for getMessage(String,Object[])voidsetApplication(ServletContext application) Set the application associated with this instance.voidsetForward(ActionForward forward) Set the forward associated with this instance.voidsetRequest(HttpServletRequest request) Set the request associated with this object.voidsetResources(ServletContext application, HttpServletRequest request, HttpServletResponse response) Set the application and request for this object instance.voidsetResponse(HttpServletResponse response) Set the response associated with this isntance.voidsetSession(HttpSession session) Set the session associated with this instance.
-
Constructor Details
-
ConfigHelper
public ConfigHelper() -
ConfigHelper
public ConfigHelper(ServletContext application, HttpServletRequest request, HttpServletResponse response)
-
-
Method Details
-
setApplication
Set the application associated with this instance. [servlet.getServletContext()]
-
setSession
Set the session associated with this instance.
-
setRequest
Set the request associated with this object. Session object is also set or cleared.
-
setResponse
Set the response associated with this isntance. Session object is also set or cleared.
-
setForward
Set the forward associated with this instance. -
setResources
public void setResources(ServletContext application, HttpServletRequest request, HttpServletResponse response) Set the application and request for this object instance. The ServletContext can be set by any servlet in the application. The request should be the instant request. Most of the other methods retrieve their own objects by reference to the application, request, or session attributes. Do not call other methods without setting these first! This is also called by the convenience constructor.
- Parameters:
application- - The associated ServletContext.request- - The associated HTTP request.response- - The associated HTTP response.
-
getActionMessages
Description copied from interface:ConfigHelperInterfaceThe
org.apache.struts.action.ActionFormBeanscollection for this application.- Specified by:
getActionMessagesin interfaceConfigHelperInterface
-
getMessageResources
The application resources for this application.
- Specified by:
getMessageResourcesin interfaceConfigHelperInterface
-
getServletMapping
The path-mapped pattern (
/action/*) or extension mapped pattern ((*.do) used to determine our Action URIs in this application.- Specified by:
getServletMappingin interfaceConfigHelperInterface
-
getToken
The transaction token stored in this session, if it is used.
- Specified by:
getTokenin interfaceConfigHelperInterface
-
getException
The runtime JspException that may be been thrown by a Struts tag extension, or compatible presentation extension, and placed in the request.
- Specified by:
getExceptionin interfaceConfigHelperInterface
-
getMultipartRequestWrapper
The multipart object for this request.
- Specified by:
getMultipartRequestWrapperin interfaceConfigHelperInterface
-
getMapping
The
org.apache.struts.ActionMappinginstance for this request.- Specified by:
getMappingin interfaceConfigHelperInterface
-
isMessage
Return true if a message string for the specified message key is present for the user's Locale.
- Specified by:
isMessagein interfaceConfigHelperInterface- Parameters:
key- Message key
-
getActionForm
Description copied from interface:ConfigHelperInterfaceRetrieve and return the
ActionFormbean associated with this mapping, creating and stashing one if necessary. If there is no form bean associated with this mapping, returnnull.- Specified by:
getActionFormin interfaceConfigHelperInterface
-
getFormBean
Return the form bean definition associated with the specified logical name, if any; otherwise return
null.- Specified by:
getFormBeanin interfaceConfigHelperInterface- Parameters:
name- Logical name of the requested form bean definition
-
getActionForward
Return the forwarding associated with the specified logical name, if any; otherwise return
null.- Specified by:
getActionForwardin interfaceConfigHelperInterface- Parameters:
name- Logical name of the requested forwarding
-
getActionMapping
Return the mapping associated with the specified request path, if any; otherwise return
null.- Specified by:
getActionMappingin interfaceConfigHelperInterface- Parameters:
path- Request path for which a mapping is requested
-
getActionMappingName
Return the form action converted into an action mapping path. The value of the
actionproperty is manipulated as follows in computing the name of the requested mapping:- Any filename extension is removed (on the theory that extension mapping is being used to select the controller servlet).
- If the resulting value does not start with a slash, then a slash is prepended.
- Specified by:
getActionMappingNamein interfaceConfigHelperInterface
-
getActionMappingURL
Return the form action converted into a server-relative URL.
- Specified by:
getActionMappingURLin interfaceConfigHelperInterface
-
getEncodeURL
Return the url encoded to maintain the user session, if any.
- Specified by:
getEncodeURLin interfaceConfigHelperInterface
-
getOrigRef
Renders the reference for a HTML <base> element
- Specified by:
getOrigRefin interfaceConfigHelperInterface
-
getBaseRef
Renders the reference for a HTML
element. - Specified by:
getBaseRefin interfaceConfigHelperInterface
-
getLink
Return the path for the specified forward, otherwise return
null.- Specified by:
getLinkin interfaceConfigHelperInterface- Parameters:
name- Name given to local or global forward.
-
getMessage
Return the localized message for the specified key, otherwise return
null.- Specified by:
getMessagein interfaceConfigHelperInterface- Parameters:
key- Message key
-
getMessage
Look up and return a message string, based on the specified parameters.
- Specified by:
getMessagein interfaceConfigHelperInterface- Parameters:
key- Message key to be looked up and returnedargs- Replacement parameters for this message
-
getAction
Return the URL for the specified ActionMapping, otherwise return
null.- Specified by:
getActionin interfaceConfigHelperInterface- Parameters:
path- Name given to local or global forward.
-
link
Wrapper for getLink(String)
- Parameters:
name- Name given to local or global forward.
-
message
Wrapper for getMessage(String)
- Parameters:
key- Message key
-
message
Wrapper for getMessage(String,Object[])
- Parameters:
key- Message key to be looked up and returnedargs- Replacement parameters for this message
-
action
Wrapper for getAction(String)
- Parameters:
path- Name given to local or global forward.
-