husted 2004/03/28 16:52:09 Added: chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts MailReaderAction.java ContextAction.java CommandAction.java ActionHelperBase.java ActionHelper.java Log: Refactor class and packages naming. Revision Changes Path 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/MailReaderAction.java Index: MailReaderAction.java =================================================================== /* * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/MailReaderAction.java,v 1.1 2004/03/29 00:52:09 husted Exp $ * $Revision: 1.1 $ * $Date: 2004/03/29 00:52:09 $ * * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.chain.mailreader.struts; import org.apache.commons.chain.Context; import org.apache.commons.chain.mailreader.ClientContext; import org.apache.commons.chain.mailreader.MailReaderBase; import java.util.Locale; /** * <p>Process Commands using a [EMAIL PROTECTED] org.apache.commons.chain.mailreader.MailReader} * [EMAIL PROTECTED] ClientContext}.</p> */ public class MailReaderAction extends CommandAction { // See interface for JavaDoc public ClientContext getContext(ActionHelper helper) { Locale locale = helper.getLocale(); Context input = getInput(helper.getActionForm()); return new MailReaderBase(locale, input); } } 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ContextAction.java Index: ContextAction.java =================================================================== /* * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ContextAction.java,v 1.1 2004/03/29 00:52:09 husted Exp $ * $Revision: 1.1 $ * $Date: 2004/03/29 00:52:09 $ * * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.chain.mailreader.struts; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * <p> * Create ActionHelper from standard <code>execute</code> call * and pass to a helper form of <code>execute</code>, * to be extended by a subclass. * </p> */ public abstract class ContextAction extends Action { /** * <p> * Token representing a nominal outcome ["success"]. * </p> */ private static String SUCCESS = "success"; /** * <p> * Convenience method to find a forward named "success". * </p> * @param helper Our ActionHelper * @return a forward named "success" or null. */ protected ActionForward findSuccess(ActionHelper helper) { return helper.getMapping().findForward(SUCCESS); } /** * <p> * Convenience method to return the Input forward. * Assumes the InputForward option and input property is set. * Otherwise, returns <code>null</code>. * </p> * @param helper Our ActionHelper * @return a forward named "success" or null. */ protected ActionForward findInput(ActionHelper helper) { return helper.getMapping().getInputForward(); } /** * <p> * Process the request represented by the [EMAIL PROTECTED] ActionHelper}, and return an * [EMAIL PROTECTED] ActionForward} representing the resource that will create the * corresonding response (or create the response directly and return null). * Exception-handling can be managed here or through the Struts configuration, * the Struts configuration being preferred. * </p> * @param helper The ActionHelper we are processing * @exception java.lang.Exception if the application business logic throws * an exception */ public abstract ActionForward execute(ActionHelper helper) throws Exception; /** * <p> * Create [EMAIL PROTECTED] ActionHelper} and return result of <code>execute(ActionHelper)</code>. * Concrete subclasses must implement <code>execute(ActionHelper)</code>. * See [EMAIL PROTECTED] CommandAction} for an example. * </p> * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception java.lang.Exception if the application business logic throws * an exception */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionHelper helper = new ActionHelperBase(request, response); return execute(helper); } } 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/CommandAction.java Index: CommandAction.java =================================================================== package org.apache.commons.chain.mailreader.struts; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.chain.Catalog; import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; import org.apache.commons.chain.impl.ContextBase; import org.apache.commons.chain.mailreader.ClientContext; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.DynaActionForm; import java.util.HashMap; import java.util.Map; /** * <p> * Create [EMAIL PROTECTED] ActionHelperBase} pass [EMAIL PROTECTED] Command} corresponding to the * ActionForm name. On return, analyze business [EMAIL PROTECTED] Context}, returning values * in servlet contexts as appropriate. * </p> */ public abstract class CommandAction extends ContextAction { /** * <p> * Return the relevant [EMAIL PROTECTED] Command} from the default * [EMAIL PROTECTED] Catalog}. * </p> * @return Command for this helper */ protected Command getCatalogCommand(ActionHelper helper) { Catalog catalog = helper.getCatalog(); String name = helper.getMapping().getName(); return catalog.getCommand(name); } /** * <p> * Return the [EMAIL PROTECTED] ClientContext} for this request. * Must be implemented by a concrete subclass. * </p> * @param helper * @return */ protected abstract ClientContext getContext(ActionHelper helper); /** * <p> * Operations to perform prior to executing business command. * If operations fail, return an appropriate [EMAIL PROTECTED] ActionForward}. * If operations succeed, return <code>null</code>. * </p> * @param helper Our ActionHelper * @param context Our ClientContext * @return ActionForward to follow, or null */ protected ActionForward preExecute(ActionHelper helper, ClientContext context) { // override to provide functionality return null; } /** * <p>Convert [EMAIL PROTECTED] ActionForm} to [EMAIL PROTECTED] Context}.</p> * @param form Our ActionForm (conventonal or dynamic) * @return Context based on ActionForm values */ protected Context getInput(ActionForm form) { Map input; if (form instanceof DynaActionForm) { DynaActionForm dyna = (DynaActionForm) form; input = dyna.getMap(); } else try { input = BeanUtils.describe(form); } catch (Throwable t) { input = new HashMap(); // FIXME: Lame resolution } return new ContextBase(input); } /** * <p>Transfer input properties (back) to ActionForm.</p> * @param helper Our ActionHelper * @param context Our ClientContext */ protected void conformInput(ActionHelper helper, ClientContext context) { Context input = context.getInput(); helper.setInputToForm(input); } /** * <p>Transfer framework properties (back) to framework objects.</p> * @param helper Our ActionHelper * @param context Our ClientContext */ protected void conformState(ActionHelper helper, ClientContext context) { helper.setLocale(context.getLocale()); } /** * <p> * Operations to perform prior to executing business command. * </p> * @param helper Our ActionHelper * @param context Our ClientContext * @return ActionForward to follow, or null */ protected ActionForward postExecute(ActionHelper helper, ClientContext context) { conformInput(helper, context); conformState(helper, context); // TODO: Expose any output // TODO: Expose any status messages, // TODO: Expose any error messages and find input return null; } /** * <p>Convenience method to return nominal location.</p> * @param mapping Our ActionMapping * @return ActionForward named "success" or null */ protected ActionForward findSuccess(ActionMapping mapping) { return mapping.findForward("success"); } // See interface for JavaDoc public ActionForward execute(ActionHelper helper) throws Exception { ActionForward location; ClientContext context = getContext(helper); location = preExecute(helper, context); if (location != null) return location; boolean stop = getCatalogCommand(helper).execute(context); location = postExecute(helper, context); if (location != null) return location; return findSuccess(helper); } // ModuleContext -> state for a module (mappings, messages) : ReadOnly // ClientContext -> runtime input for this request/client (locale,form) : ReadWrite // ActionContext -> ClientState, ModuleState // StrutsContext -> state for entire Struts application : ReadWrite // StrutsContext.createActionContext(request); } 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ActionHelperBase.java Index: ActionHelperBase.java =================================================================== /* * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ActionHelperBase.java,v 1.1 2004/03/29 00:52:09 husted Exp $ * $Revision: 1.1 $ * $Date: 2004/03/29 00:52:09 $ * * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.chain.mailreader.struts; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.chain.Catalog; import org.apache.commons.chain.Context; import org.apache.struts.Globals; import org.apache.struts.action.*; import org.apache.struts.upload.MultipartRequestWrapper; import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.sql.DataSource; import java.util.Locale; /** * <p> * NOTE -- This implementation was designed to work with the * default module only. Many methods won't work with modular * applications. * </p> * <p> * NOTE -- In the next version, a "ClientContext" interface * and implementation will be added to this class to allow * access to operations business Commands might use without * exposing Http signatures or other implementation details. * </p> * <p> * NOTE -- At some point, a "disconnected" implementation should be * available so that the Http resources do not have be cached * as class members. * </p> * <p> * NOTE -- This class may be migrated to a later release of Struts * when support for Commons Chains is added. * </p> */ public class ActionHelperBase implements ActionHelper { // -------------------------------------------------------- Properties /** * The application associated with this instance. */ private ServletContext application = null; /** * Set the application associated with this instance. * [servlet.getServletContext()] */ public void setApplication(ServletContext application) { this.application = application; } /** * The session associated with this instance. */ private HttpSession session = null; /** * Set the session associated with this instance. */ public void setSession(HttpSession session) { this.session = session; } /** * The request associated with this instance. */ private HttpServletRequest request = null; /** * Set the request associated with this object. * Session object is also set or cleared. */ public void setRequest(HttpServletRequest request) { this.request = request; if (this.request == null) setSession(null); else setSession(this.request.getSession()); } /** * The response associated with this instance. */ private HttpServletResponse response = null; /** * Set the response associated with this isntance. * Session object is also set or cleared. */ public void setResponse(HttpServletResponse response) { this.response = response; } /** * The forward associated with this instance. */ private ActionForward forward = null; /** * Set the forward associated with this instance. */ public void setForward(ActionForward forward) { this.forward = forward; } /** * 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. * * @param request - The associated HTTP request. * @param response - The associated HTTP response. */ public void setResources( HttpServletRequest request, HttpServletResponse response) { ServletContext application = request.getSession().getServletContext(); setApplication(application); setRequest(request); setResponse(response); } public ActionHelperBase() { super(); } public ActionHelperBase( HttpServletRequest request, HttpServletResponse response) { super(); this.setResources(request, response); } // ------------------------------------------------ Application Context // See ActionHelper interface for JavaDoc public DataSource getDataSource() { if (this.application == null) return null; return (DataSource) this.application.getAttribute(Globals.DATA_SOURCE_KEY); } // See ActionHelper interface for JavaDoc public ActionMessages getActionErrors() { if (this.application == null) return null; return (ActionMessages) this.application.getAttribute(Globals.ERROR_KEY); } // See ActionHelper interface for JavaDoc public ActionMessages getActionMessages() { if (this.application == null) return null; return (ActionMessages) this.application.getAttribute(Globals.MESSAGE_KEY); } // See ActionHelper interface for JavaDoc public MessageResources getMessageResources() { if (this.application == null) { return null; } return (MessageResources) this.application.getAttribute(Globals.MESSAGES_KEY); } // See ActionHelper interface for JavaDoc public String getServletMapping() { if (this.application == null) { return null; } return (String) this.application.getAttribute(Globals.SERVLET_KEY); } // ---------------------------------------------------- Session Context // See ActionHelper interface for JavaDoc public Locale getLocale() { if (this.session == null) { return null; } return (Locale) session.getAttribute(Globals.LOCALE_KEY); } // See ActionHelper interface for JavaDoc public void setLocale(Locale locale) { session.setAttribute(Globals.LOCALE_KEY, locale); } // See ActionHelper interface for JavaDoc public String getToken() { if (this.session == null) { return null; } return (String) session.getAttribute(Globals.TRANSACTION_TOKEN_KEY); } // ---------------------------------------------------- Request Context // See ActionHelper interface for JavaDoc public Throwable getException() { if (this.request == null) { return null; } return (Throwable) this.request.getAttribute(Globals.EXCEPTION_KEY); } // See ActionHelper interface for JavaDoc public MultipartRequestWrapper getMultipartRequestWrapper() { if (this.request == null) { return null; } return (MultipartRequestWrapper) this.request.getAttribute(Globals.MULTIPART_KEY); } // See ActionHelper interface for JavaDoc public ActionMapping getMapping() { if (this.request == null) { return null; } return (ActionMapping) this.request.getAttribute(Globals.MAPPING_KEY); } // ---------------------------------------------------- Utility Methods // See ActionHelper interface for JavaDoc public boolean isMessage(String key) { // Look up the requested MessageResources MessageResources resources = getMessageResources(); if (resources == null) { return false; } // Return the requested message presence indicator return resources.isPresent(RequestUtils.getUserLocale(request, null), key); } // See ActionHelper interface for JavaDoc public ActionForm getActionForm() { // Is there a mapping associated with this request? ActionMapping mapping = getMapping(); if (mapping == null) return (null); // Is there a form bean associated with this mapping? String attribute = mapping.getAttribute(); if (attribute == null) return (null); // Look up the existing form bean, if any ActionForm instance = null; if ("request".equals(mapping.getScope())) { instance = (ActionForm) this.request.getAttribute(attribute); } else { instance = (ActionForm) this.session.getAttribute(attribute); } return instance; } // See ActionHelper interface for JavaDoc // TODO: public ActionFormBean getFormBean(String name) { return null; } // See ActionHelper interface for JavaDoc // TODO: public ActionForward getActionForward(String name) { return null; } // See ActionHelper interface for JavaDoc // TODO: public ActionMapping getActionMapping(String path) { return null; } // See ActionHelper interface for JavaDoc public String getActionMappingName(String action) { String value = action; int question = action.indexOf("?"); if (question >= 0) value = value.substring(0, question); int slash = value.lastIndexOf("/"); int period = value.lastIndexOf("."); if ((period >= 0) && (period > slash)) value = value.substring(0, period); if (value.startsWith("/")) return (value); else return ("/" + value); } // See ActionHelper interface for JavaDoc public String getActionMappingURL(String action) { StringBuffer value = new StringBuffer(this.request.getContextPath()); // Use our servlet mapping, if one is specified String servletMapping = getServletMapping(); if (servletMapping != null) { String queryString = null; int question = action.indexOf("?"); if (question >= 0) queryString = action.substring(question); String actionMapping = getActionMappingName(action); if (servletMapping.startsWith("*.")) { value.append(actionMapping); value.append(servletMapping.substring(1)); } else if (servletMapping.endsWith("/*")) { value.append(servletMapping.substring(0, servletMapping.length() - 2)); value.append(actionMapping); } if (queryString != null) value.append(queryString); } // Otherwise, assume extension mapping is in use and extension is // already included in the action property else { if (!action.startsWith("/")) value.append("/"); value.append(action); } // Return the completed value return (value.toString()); } // See ActionHelper interface for JavaDoc public String getEncodeURL(String url) { if ((session != null) && (response != null)) { boolean redirect = false; if (forward != null) redirect = forward.getRedirect(); if (redirect) return response.encodeRedirectURL(url); else return response.encodeURL(url); } else return (url); } // ------------------------------------------------ Presentation API // See ActionHelper interface for JavaDoc public String getOrigRef() { // HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); if (request == null) return null; StringBuffer result = RequestUtils.requestToServerUriStringBuffer(request); return result.toString(); } // See ActionHelper interface for JavaDoc public String getBaseRef() { if (request == null) return null; StringBuffer result = RequestUtils.requestToServerStringBuffer(request); String path = null; if (forward == null) path = request.getRequestURI(); else path = request.getContextPath() + forward.getPath(); result.append(path); return result.toString(); } // See ActionHelper interface for JavaDoc public String getLink(String name) { ActionForward forward = getActionForward(name); if (forward == null) return null; StringBuffer path = new StringBuffer(this.request.getContextPath()); path.append(forward.getPath()); // TODO: What about runtime parameters? return getEncodeURL(path.toString()); } // See ActionHelper interface for JavaDoc public String getMessage(String key) { MessageResources resources = getMessageResources(); if (resources == null) return null; return resources.getMessage(RequestUtils.getUserLocale(request, null), key); } // See ActionHelper interface for JavaDoc public String getMessage(String key, Object args[]) { MessageResources resources = getMessageResources(); if (resources == null) return null; // Return the requested message if (args == null) return resources.getMessage( RequestUtils.getUserLocale(request, null), key); else return resources.getMessage( RequestUtils.getUserLocale(request, null), key, args); } // See ActionHelper interface for JavaDoc public String getAction(String path) { return getEncodeURL(getActionMappingURL(path)); } // ------------------------------------------------- Catalog / Context // See ActionHelper interface for JavaDoc public Catalog getCatalog() { return (Catalog) application.getAttribute("catalog"); } // See ActionHelper interface for JavaDoc public void setInputAsForm(Context input) { ActionMapping mapping = getMapping(); String formScope = mapping.getScope(); String name = mapping.getName(); if ("request".equals(formScope)) request.setAttribute(name, input); else request.getSession().setAttribute(name, input); } // See ActionHelper interface for JavaDoc public void setInputToForm(Context input) { ActionForm form = getActionForm(); try { BeanUtils.copyProperties(form, input); } catch (Throwable t) { // FIXME: Now what? Log and Throw? } } // --------------------------------------------- Presentation Wrappers /** * <p>Wrapper for getLink(String)</p> * @param name Name given to local or global forward. */ public String link(String name) { return getLink(name); } /** * <p>Wrapper for getMessage(String)</p> * @param key Message key */ public String message(String key) { return getMessage(key); } /** * <p>Wrapper for getMessage(String,Object[])</p> * @param key Message key to be looked up and returned * @param args Replacement parameters for this message */ public String message(String key, Object args[]) { return getMessage(key, args); } /** * <p>Wrapper for getAction(String)</p> * @param path Name given to local or global forward. */ public String action(String path) { return getAction(path); } } 1.1 jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ActionHelper.java Index: ActionHelper.java =================================================================== /* * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/commons/chain/mailreader/struts/ActionHelper.java,v 1.1 2004/03/29 00:52:09 husted Exp $ * $Revision: 1.1 $ * $Date: 2004/03/29 00:52:09 $ * * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.chain.mailreader.struts; import org.apache.commons.chain.Catalog; import org.apache.commons.chain.Context; import org.apache.struts.action.*; import org.apache.struts.upload.MultipartRequestWrapper; import org.apache.struts.util.MessageResources; import javax.sql.DataSource; import java.util.Locale; /** * <p> * [This class is based on the experimental ConfigHelper class, * and is under active development.] * <p> * A Context exposing the Struts shared resources, * which are be stored in the application, session, or * request contexts, as appropriate. * </p> * <p> * An instance should be created for each request * processed. The methods which return resources from * the request or session contexts are not thread-safe. * </p> * <p> * Provided for use by Commands and other components in the * application so they can easily access the various Struts * shared resources. These resources may be stored under * attributes in the application, session, or request contexts, * but users of this class do not need to know what goes where. * </p> * <p> * The ActionHelperBase methods simply return the resources * from under the context and key used by the Struts * ActionServlet when the resources are created. * </p> */ public interface ActionHelper { // ------------------------------------------------ Application Context /** * <p> * The default DataSource instance registered with the * ActionServlet, or <code>null</code> is none is registered. * </p> * @return The default DataSource instance or null */ public DataSource getDataSource(); /** * <p> * The collection of error messages for this request, * or null if none are available. * </p> */ public ActionMessages getActionErrors(); /** * <p> * The collection of general messages for this request, * or null if none are available. * </p> */ public ActionMessages getActionMessages(); /** * <p>The application resources for this application.</p> */ public MessageResources getMessageResources(); /** * <p> * The path-mapped pattern (<code>/action/*</code>) or * extension mapped pattern ((<code>*.do</code>) * used to determine our Action URIs in this application. * </p> */ public String getServletMapping(); // ---------------------------------------------------- Session Context /** * <p> * Return the Locale associated with this client, or null if none. * </p> */ public Locale getLocale(); /** * <p> * Assign the Locale to associate with this client. * </p> */ public void setLocale(Locale locale); /** * <p> * The transaction token stored in this session, if it is used. * </p> */ public String getToken(); // ---------------------------------------------------- Request Context /** * <p> * The runtime JspException that may be been thrown by a Struts tag * extension, or compatible presentation extension, and placed * in the request. * </p> */ public Throwable getException(); /** * <p>The multipart object for this request.</p> */ public MultipartRequestWrapper getMultipartRequestWrapper(); /** * <p> * The <code>org.apache.struts.ActionMapping</code> * instance for this request. * </p> */ public ActionMapping getMapping(); // ---------------------------------------------------- Utility Methods /** * <p> * Return true if a message string for the specified message key * is present for the clients's Locale. * </p> * @param key Message key */ public boolean isMessage(String key); /** * <p> * Retrieve and return the <code>ActionForm</code> instance associated with * this mapping. If there is no ActionForm present, return <code>null</code>. * </p> */ public ActionForm getActionForm(); /** * <p> * Return the form bean definition associated with the specified * logical name, if any; otherwise return <code>null</code>. * </p> * @param name Logical name of the requested form bean definition */ public ActionFormBean getFormBean(String name); /** * <p> * Return the forwarding associated with the specified logical name, * if any; otherwise return <code>null</code>. * </p> * @param name Logical name of the requested forwarding */ public ActionForward getActionForward(String name); /** * <p> * Return the mapping associated with the specified request path, if any; * otherwise return <code>null</code>. * </p> * @param path Request path for which a mapping is requested */ public ActionMapping getActionMapping(String path); /** * <p> * Return the form action converted into an action mapping path. The * value of the <code>action</code> property is manipulated as follows in * computing the name of the requested mapping: * </p> * <ul> * <li> * Any filename extension is removed (on the theory that extension * mapping is being used to select the controller servlet). * </li> * <li> * If the resulting value does not start with a slash, then a * slash is prepended. * </li> * </ul> * <p>FIXME: Bad assumption =:o)</p> */ public String getActionMappingName(String action); /** * <p> * Return the form action converted into a server-relative URL. * </p> */ public String getActionMappingURL(String action); /** * <p> * Return the url encoded to maintain the user session, if any. * </p> */ public String getEncodeURL(String url); // ----------------------------------------------- Catalog / Context /** * <p>Returns the default Command Catalog, if any.</p> * @return the default Command Catalog. */ public Catalog getCatalog(); /** * <p> * Replace the ActionForm instance with an Input context. * Useful in JSTL or Velocity environments. * </p> * @param input Input Context */ public void setInputAsForm(Context input); /** * <p> * Copy input context attributes over matching ActionForm properties. * </p> * @param input Input Context */ public void setInputToForm(Context input); // ------------------------------------------------ Presentation API /** * <p>Renders the reference for a HTML base element.</p> */ public String getOrigRef(); /** * <p>Renders the reference for a HTML <base> element.</p> */ public String getBaseRef(); /** * <p> * Return the path for the specified forward, * otherwise return <code>null</code>. * </p> * @param name Name given to local or global forward. */ public String getLink(String name); /** * <p> * Return the localized message for the specified key, * otherwise return <code>null</code>. * </p> * @param key Message key */ public String getMessage(String key); /** * <p> * Look up and return a message string, based on the specified parameters. * </p> * @param key Message key to be looked up and returned * @param args Replacement parameters for this message */ public String getMessage(String key, Object args[]); /** * <p> * Return the URL for the specified ActionMapping, * otherwise return <code>null</code>. * </p> * @param path Name given to local or global forward. */ public String getAction(String path); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]