⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionconfig.java.svn-base

📁 MVC开源框架
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
/* * $Id$ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements.  See the NOTICE file * distributed with this work for additional information * regarding copyright ownership.  The ASF licenses this file * to you 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.struts.config;import org.apache.commons.beanutils.BeanUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.struts.util.RequestUtils;import java.lang.reflect.InvocationTargetException;import java.util.ArrayList;import java.util.HashMap;/** * <p>A JavaBean representing the configuration information of an * <code>&lt;action&gt;</code> element from a Struts module configuration * file.</p> * * @version $Rev$ $Date$ * @since Struts 1.1 */public class ActionConfig extends BaseConfig {    private static final Log log = LogFactory.getLog(ActionConfig.class);    /**     * Literal that describes request condition for "reset" and "populate"     * properties.     *     * @since Struts 1.4     */    public static final String REQUEST_STR = "request";    /**     * Literal that describes forward condition for "reset" and "populate"     * properties.     *     * @since Struts 1.4     */    public static final String FORWARD_STR = "forward";    // ----------------------------------------------------- Instance Variables    /**     * <p> The set of exception handling configurations for this action, if     * any, keyed by the <code>type</code> property. </p>     */    protected HashMap exceptions = new HashMap();    /**     * <p> The set of local forward configurations for this action, if any,     * keyed by the <code>name</code> property. </p>     */    protected HashMap forwards = new HashMap();    // ------------------------------------------------------------- Properties    /**     * <p> The module configuration with which we are associated. </p>     */    protected ModuleConfig moduleConfig = null;    /**     * <p> The request-scope or session-scope attribute name under which our     * form bean is accessed, if it is different from the form bean's     * specified <code>name</code>. </p>     */    protected String attribute = null;    /**     * <p>The internal identification of this action mapping. Identifications are     * not inheritable and must be unique within a module.</p>     *     * @since Struts 1.3.6     */    protected String actionId = null;    /**     * <p>The path of the ActionConfig that this object should inherit     * properties from.</p> </p>     */    protected String inherit = null;    /**     * Indicates whether the "cancellable " property has been set or not.     */    private boolean cancellableSet = false;    /**     * <p>Can this Action be cancelled? [false]</p> <p> By default, when an     * Action is cancelled, validation is bypassed and the Action should not     * execute the business operation. If a request tries to cancel an Action     * when cancellable is not set, a "InvalidCancelException" is thrown.     * </p>     */    protected boolean cancellable = false;    /**     * <p> Have the inheritance values for this class been applied?</p>     */    protected boolean extensionProcessed = false;    /**     * <p> Context-relative path of the web application resource that will     * process this request via RequestDispatcher.forward(), instead of     * instantiating and calling the <code>Action</code> class specified by     * "type". Exactly one of <code>forward</code>, <code>include</code>, or     * <code>type</code> must be specified. </p>     */    protected String forward = null;    /**     * <p> Context-relative path of the web application resource that will     * process this request via RequestDispatcher.include(), instead of     * instantiating and calling the <code>Action</code> class specified by     * "type". Exactly one of <code>forward</code>, <code>include</code>, or     * <code>type</code> must be specified. </p>     */    protected String include = null;    /**     * <p> Context-relative path of the input form to which control should be     * returned if a validation error is encountered.  Required if "name" is     * specified and the input bean returns validation errors. </p>     */    protected String input = null;    /**     * <p> Fully qualified Java class name of the <code>MultipartRequestHandler</code>     * implementation class used to process multi-part request data for this     * Action. </p>     */    protected String multipartClass = null;    /**     * <p> Name of the form bean, if any, associated with this Action. </p>     */    protected String name = null;    /**     * <p> General purpose configuration parameter that can be used to pass     * extra information to the Action instance selected by this Action.     * Struts does not itself use this value in any way. </p>     */    protected String parameter = null;    /**     * <p> Context-relative path of the submitted request, starting with a     * slash ("/") character, and omitting any filename extension if extension     * mapping is being used. </p>     */    protected String path = null;    /**     * <p> Prefix used to match request parameter names to form bean property     * names, if any. </p>     */    protected String prefix = null;    /**     * <p> Comma-delimited list of security role names allowed to request this     * Action. </p>     */    protected String roles = null;    /**     * <p> The set of security role names used to authorize access to this     * Action, as an array for faster access. </p>     */    protected String[] roleNames = new String[0];    /**     * <p> Identifier of the scope ("request" or "session") within which our     * form bean is accessed, if any. </p>     */    protected String scope = "session";    /**     * <p>Identifies conditions for automatic form reset.</p>     *     * <p>Possible values: null (not specified), "request", "forward" or     * "request-forward" (used when not specified). If not specified then     * the form bean is reset both for direct and for forwarded request.</p>     *     * @since Struts 1.4     */    protected String reset = REQUEST_STR + "-" + FORWARD_STR;    /**     * <p>Identifies conditions for automatic form population with values     * from HTTP request.</p>     *     * <p>Possible values: null (not specified), "request", "forward" or     * "request-forward" (used when not specified). If not specified then     * the form bean is populated both for direct and for forwarded request.     * This means that when a chained action mapping refers to the same     * form bean as originating action, then the form bean is repopulated     * and changes made by originating action are lost.</p>     *     * @since Struts 1.4     */    protected String populate = REQUEST_STR + "-" + FORWARD_STR;    /**     * <p> Suffix used to match request parameter names to form bean property     * names, if any. </p>     */    protected String suffix = null;    /**     * <p> Fully qualified Java class name of the <code>Action</code> class to     * be used to process requests for this mapping if the     * <code>forward</code> and <code>include</code> properties are not set.     * Exactly one of <code>forward</code>, <code>include</code>, or     * <code>type</code> must be specified.     */    protected String type = null;    /**     * <p> Indicates Action be configured as the default one for this module,     * when true.     */    protected boolean unknown = false;    /**     * Indicates whether the "validate" property has been set or not.     */    private boolean validateSet = false;    /**     * <p> Should the <code>validate()</code> method of the form bean     * associated with this action be called?     */    protected boolean validate = true;    /**     * <p> The name of a <code>commons-chain</code> command which should be     * executed as part of the processing of this action.     *     * @since Struts 1.3.0     */    protected String command = null;    /**     * <p> The name of a <code>commons-chain</code> catalog in which     * <code>command</code> should be sought.  If a <code>command</code> is     * defined and this property is undefined, the "default" catalog will be     * used. This is likely to be infrequently used after a future release of     * <code>commons-chain</code> supports a one-string expression of a     * catalog/chain combination.     *     * @since Struts 1.3.0     */    protected String catalog = null;    /**     * <p>The internal name of this action mapping. If an action has a name, it may be used     * as a shortcut in a URI. For example, an action with an identification of "editPerson"     * may be internally forwarded as "editPerson?id=1" which will then resolve to the     * real URI path at execution time.</p>     *     * @return the actionId     * @since Struts 1.3.6     */    public String getActionId() {        return this.actionId;    }    /**     * <p>The internal name of this action mapping. The name is not inheritable,     * may not contain a forward slash, and must be unique within a module. </p>     *     * @param actionId the action identifier     * @since Struts 1.3.6     * @throws IllegalStateException if the configuration is frozen     * @throws IllegalArgumentException if the identifier contains a forward slash     */    public void setActionId(String actionId) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }                if ((actionId != null) && (actionId.indexOf("/") > -1)) {            throw new IllegalArgumentException("actionId '" + actionId + "' may not contain a forward slash");        }        this.actionId = actionId;    }    /**     * <p> The module configuration with which we are associated.     */    public ModuleConfig getModuleConfig() {        return (this.moduleConfig);    }    /**     * <p> The module configuration with which we are associated.     */    public void setModuleConfig(ModuleConfig moduleConfig) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.moduleConfig = moduleConfig;    }    /**     * <p> Returns the request-scope or session-scope attribute name under     * which our form bean is accessed, if it is different from the form     * bean's specified <code>name</code>.     *     * @return attribute name under which our form bean is accessed.     */    public String getAttribute() {        if (this.attribute == null) {            return (this.name);        } else {            return (this.attribute);        }    }    /**     * <p> Set the request-scope or session-scope attribute name under which     * our form bean is accessed, if it is different from the form bean's     * specified <code>name</code>.     *     * @param attribute the request-scope or session-scope attribute name     *                  under which our form bean is access.     */    public void setAttribute(String attribute) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.attribute = attribute;    }    /**     * <p>Accessor for cancellable property</p>     *     * @return True if Action can be cancelled     */    public boolean getCancellable() {        return (this.cancellable);    }    /**     * <p>Mutator for for cancellable property</p>     *     * @param cancellable     */    public void setCancellable(boolean cancellable) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.cancellable = cancellable;        this.cancellableSet = true;    }    /**     * <p>Returns the path of the ActionConfig that this object should inherit     * properties from.</p>     *     * @return the path of the ActionConfig that this object should inherit     *         properties from.     */    public String getExtends() {        return (this.inherit);    }    /**     * <p>Set the path of the ActionConfig that this object should inherit     * properties from.</p>     *     * @param inherit the path of the ActionConfig that this object should     *                inherit properties from.     */    public void setExtends(String inherit) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.inherit = inherit;    }    public boolean isExtensionProcessed() {        return extensionProcessed;    }    /**     * <p> Returns context-relative path of the web application resource that     * will process this request.     *     * @return context-relative path of the web application resource that will     *         process this request.     */    public String getForward() {        return (this.forward);    }    /**     * <p> Set the context-relative path of the web application resource that     * will process this request. Exactly one of <code>forward</code>,     * <code>include</code>, or <code>type</code> must be specified.     *     * @param forward context-relative path of the web application resource     *                that will process this request.     */    public void setForward(String forward) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.forward = forward;    }    /**     * <p> Context-relative path of the web application resource that will     * process this request.     *     * @return Context-relative path of the web application resource that will     *         process this request.     */    public String getInclude() {        return (this.include);    }    /**     * <p> Set context-relative path of the web application resource that will     * process this request. Exactly one of <code>forward</code>,     * <code>include</code>, or <code>type</code> must be specified.     *     * @param include context-relative path of the web application resource     *                that will process this request.     */    public void setInclude(String include) {        if (configured) {            throw new IllegalStateException("Configuration is frozen");        }        this.include = include;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -