亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dispatchaction.java

?? struts的源代碼
?? JAVA
字號:
/*
 * $Id: DispatchAction.java 384089 2006-03-08 01:50:52Z niallp $ 
 *
 * Copyright 2001-2006 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.struts.actions;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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 org.apache.struts.util.MessageResources;

/**
 * <p>An abstract <strong>Action</strong> that dispatches to a public
 * method that is named by the request parameter whose name is specified
 * by the <code>parameter</code> property of the corresponding
 * ActionMapping.  This Action is useful for developers who prefer to
 * combine many similar actions into a single Action class, in order to
 * simplify their application design.</p>
 *
 * <p>To configure the use of this action in your
 * <code>struts-config.xml</code> file, create an entry like this:</p>
 *
 * <code>
 *   &lt;action path="/saveSubscription"
 *           type="org.apache.struts.actions.DispatchAction"
 *           name="subscriptionForm"
 *          scope="request"
 *          input="/subscription.jsp"
 *      parameter="method"/&gt;
 * </code>
 *
 * <p>which will use the value of the request parameter named "method"
 * to pick the appropriate "execute" method, which must have the same
 * signature (other than method name) of the standard Action.execute
 * method.  For example, you might have the following three methods in the
 * same action:</p>
 * <ul>
 * <li>public ActionForward delete(ActionMapping mapping, ActionForm form,
 *     HttpServletRequest request, HttpServletResponse response)
 *     throws Exception</li>
 * <li>public ActionForward insert(ActionMapping mapping, ActionForm form,
 *     HttpServletRequest request, HttpServletResponse response)
 *     throws Exception</li>
 * <li>public ActionForward update(ActionMapping mapping, ActionForm form,
 *     HttpServletRequest request, HttpServletResponse response)
 *     throws Exception</li>
 * </ul>
 * <p>and call one of the methods with a URL like this:</p>
 * <code>
 *   http://localhost:8080/myapp/saveSubscription.do?method=update
 * </code>
 *
 * <p><strong>NOTE</strong> - All of the other mapping characteristics of
 * this action must be shared by the various handlers.  This places some
 * constraints over what types of handlers may reasonably be packaged into
 * the same <code>DispatchAction</code> subclass.</p>
 *
 * <p><strong>NOTE</strong> - If the value of the request parameter is empty,
 * a method named <code>unspecified</code> is called. The default action is
 * to throw an exception. If the request was cancelled (a <code>html:cancel</code>
 * button was pressed), the custom handler <code>cancelled</code> will be used instead.
 * You can also override the <code>getMethodName</code> method to override the action's
 * default handler selection.</p>
 *
 * @version $Rev: 384089 $ $Date: 2006-03-08 01:50:52 +0000 (Wed, 08 Mar 2006) $
 */
public abstract class DispatchAction extends Action {


    // ----------------------------------------------------- Instance Variables


    /**
     * The Class instance of this <code>DispatchAction</code> class.
     */
    protected Class clazz = this.getClass();


    /**
     * Commons Logging instance.
     */
    protected static Log log = LogFactory.getLog(DispatchAction.class);


    /**
     * The message resources for this package.
     */
    protected static MessageResources messages =
            MessageResources.getMessageResources
            ("org.apache.struts.actions.LocalStrings");


    /**
     * The set of Method objects we have introspected for this class,
     * keyed by method name.  This collection is populated as different
     * methods are called, so that introspection needs to occur only
     * once per method name.
     */
    protected HashMap methods = new HashMap();


    /**
     * The set of argument type classes for the reflected method call.  These
     * are the same for all calls, so calculate them only once.
     */
    protected Class[] types =
            {
                ActionMapping.class,
                ActionForm.class,
                HttpServletRequest.class,
                HttpServletResponse.class};



    // --------------------------------------------------------- Public Methods


    /**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an <code>ActionForward</code> instance describing where and how
     * control should be forwarded, or <code>null</code> if the response has
     * already been completed.
     *
     * @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 Exception if an exception occurs
     */
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        if (isCancelled(request)) {
            ActionForward af = cancelled(mapping, form, request, response);
            if (af != null) {
                return af;
            }
        }

        // Get the parameter. This could be overridden in subclasses.
        String parameter = getParameter(mapping, form, request, response);

        // Get the method's name. This could be overridden in subclasses.
        String name = getMethodName(mapping, form, request, response, parameter);


	// Prevent recursive calls
	if ("execute".equals(name) || "perform".equals(name)){
		String message =
			messages.getMessage("dispatch.recursive", mapping.getPath());

		log.error(message);
		throw new ServletException(message);
	}


        // Invoke the named method, and return the result
        return dispatchMethod(mapping, form, request, response, name);

    }



    
    /**
     * Method which is dispatched to when there is no value for specified
     * request parameter included in the request.  Subclasses of
     * <code>DispatchAction</code> should override this method if they wish
     * to provide default behavior different than throwing a ServletException.
     */
    protected ActionForward unspecified(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws Exception {

        String message =
                messages.getMessage(
                        "dispatch.parameter",
                        mapping.getPath(),
                        mapping.getParameter());

        log.error(message);

        throw new ServletException(message);
    }

    /**
     * Method which is dispatched to when the request is a cancel button submit.
     * Subclasses of <code>DispatchAction</code> should override this method if
     * they wish to provide default behavior different than returning null.
     * @since Struts 1.2.0
     */
    protected ActionForward cancelled(ActionMapping mapping,
                                      ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response)
            throws Exception {

        return null;
    }

    // ----------------------------------------------------- Protected Methods


    /**
     * Dispatch to the specified method.
     * @since Struts 1.1
     */
    protected ActionForward dispatchMethod(ActionMapping mapping,
                                           ActionForm form,
                                           HttpServletRequest request,
                                           HttpServletResponse response,
                                           String name) throws Exception {

        // Make sure we have a valid method name to call.
        // This may be null if the user hacks the query string.
        if (name == null) {
            return this.unspecified(mapping, form, request, response);
        }

        // Identify the method object to be dispatched to
        Method method = null;
        try {
            method = getMethod(name);

        } catch(NoSuchMethodException e) {
            String message =
                    messages.getMessage("dispatch.method", mapping.getPath(), name);
            log.error(message, e);

            String userMsg =
                messages.getMessage("dispatch.method.user", mapping.getPath());
            throw new NoSuchMethodException(userMsg);
        }

        ActionForward forward = null;
        try {
            Object args[] = {mapping, form, request, response};
            forward = (ActionForward) method.invoke(this, args);

        } catch(ClassCastException e) {
            String message =
                    messages.getMessage("dispatch.return", mapping.getPath(), name);
            log.error(message, e);
            throw e;

        } catch(IllegalAccessException e) {
            String message =
                    messages.getMessage("dispatch.error", mapping.getPath(), name);
            log.error(message, e);
            throw e;

        } catch(InvocationTargetException e) {
            // Rethrow the target exception if possible so that the
            // exception handling machinery can deal with it
            Throwable t = e.getTargetException();
            if (t instanceof Exception) {
                throw ((Exception) t);
            } else {
                String message =
                        messages.getMessage("dispatch.error", mapping.getPath(), name);
                log.error(message, e);
                throw new ServletException(t);
            }
        }

        // Return the returned ActionForward instance
        return (forward);
    }

    /**
     * <p>Returns the parameter value.</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
     * @return The <code>ActionMapping</code> parameter's value
     * @throws Exception if the parameter is missing.
     */
    protected String getParameter(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {

        // Identify the request parameter containing the method name
        String parameter = mapping.getParameter();

        if (parameter == null) {
            String message =
                messages.getMessage("dispatch.handler", mapping.getPath());

            log.error(message);

            throw new ServletException(message);
        }


        return parameter;
    }

    /**
     * Introspect the current class to identify a method of the specified
     * name that accepts the same parameter types as the <code>execute</code>
     * method does.
     *
     * @param name Name of the method to be introspected
     *
     * @exception NoSuchMethodException if no such method can be found
     */
    protected Method getMethod(String name)
            throws NoSuchMethodException {

        synchronized(methods) {
            Method method = (Method) methods.get(name);
            if (method == null) {
                method = clazz.getMethod(name, types);
                methods.put(name, method);
            }
            return (method);
        }

    }

    /**
     * Returns the method name, given a parameter's value.
     *
     * @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
     * @param parameter The <code>ActionMapping</code> parameter's name
     *
     * @return The method's name.
     * @since Struts 1.2.0
     */
    protected String getMethodName(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response,
                                   String parameter)
            throws Exception {

        // Identify the method name to be dispatched to.
        // dispatchMethod() will call unspecified() if name is null
        return request.getParameter(parameter);
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91猫先生在线| 欧美性色欧美a在线播放| 日本欧美一区二区在线观看| 亚洲国产日韩一级| 性做久久久久久免费观看| 一区二区在线观看av| 亚洲免费av网站| 亚洲欧美aⅴ...| 亚洲乱码中文字幕综合| 一区二区三区免费在线观看| 一区二区三区四区激情| 亚洲一区二区精品视频| 日韩av不卡一区二区| 美女网站色91| 国产精品一二三四区| 国产成人免费在线观看| 国产很黄免费观看久久| 国产精品久久久久精k8| 国产精品福利一区二区三区| 中日韩av电影| 在线亚洲高清视频| 欧美日韩一区二区三区高清| 欧美日韩电影在线| 日韩一级高清毛片| 亚洲精品一区二区三区香蕉| 一区二区免费视频| 亚洲人亚洲人成电影网站色| 亚洲在线视频一区| 男人操女人的视频在线观看欧美| 国产一区二区在线电影| 白白色 亚洲乱淫| 在线观看91精品国产入口| 欧美一级片免费看| 国产欧美一区视频| 亚洲与欧洲av电影| 久久国产精品99精品国产| 成人av在线资源网| 91国产免费看| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 欧美一区二区三区视频免费| av一区二区不卡| 国产精品 欧美精品| 91免费在线视频观看| 91精品婷婷国产综合久久性色| 久久亚洲影视婷婷| 亚洲精品久久7777| 精久久久久久久久久久| 91美女视频网站| 日韩欧美综合一区| 亚洲天堂福利av| 免费久久精品视频| 91视频免费看| 日韩欧美激情一区| 亚洲乱码国产乱码精品精的特点 | 麻豆精品视频在线| 色综合天天综合狠狠| 欧美成人综合网站| 亚洲在线一区二区三区| 国产精品一区二区三区99| 欧美日韩精品一区视频| 国产精品私人影院| 久久精品国产99国产精品| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 国产自产视频一区二区三区| 99久久免费视频.com| 在线观看日产精品| 久久精品免视看| 日韩综合小视频| 色香蕉久久蜜桃| 国产情人综合久久777777| 午夜影院久久久| 91视视频在线观看入口直接观看www| 欧美xxxxx牲另类人与| 亚洲国产你懂的| 91美女在线视频| 中文在线免费一区三区高中清不卡| 日韩一区精品字幕| 欧美做爰猛烈大尺度电影无法无天| 欧美国产欧美综合| 久久国产精品区| 制服丝袜av成人在线看| 亚洲综合在线观看视频| 成a人片国产精品| 国产视频一区不卡| 成人一区在线观看| 久久久久久免费网| 国产在线观看一区二区| 欧美一区二区三区免费大片| 亚洲国产aⅴ成人精品无吗| 97精品视频在线观看自产线路二| 国产精品嫩草99a| 国产成人在线看| 久久久久久99精品| 国产酒店精品激情| 久久久www成人免费无遮挡大片| 青青草精品视频| 日韩欧美卡一卡二| 蜜桃视频在线观看一区二区| 91.com视频| 视频一区中文字幕国产| 欧美美女一区二区| 日韩精品福利网| 欧美网站一区二区| 午夜婷婷国产麻豆精品| 欧美日韩在线播放三区四区| 亚洲成人www| 欧美老女人第四色| 麻豆精品一区二区三区| 日韩精品一区二区三区中文不卡 | 精品久久人人做人人爰| 精品一区二区三区免费| 亚洲精品一区二区三区99| 黄一区二区三区| 久久一区二区视频| 成人激情免费电影网址| 亚洲欧美综合网| 色综合久久天天| 视频一区视频二区中文字幕| 91精品黄色片免费大全| 极品销魂美女一区二区三区| 久久精品亚洲精品国产欧美kt∨| 成人综合在线视频| 一区二区在线看| 91麻豆精品国产91久久久久久| 美女精品一区二区| 久久精品人人做人人爽人人| 成人黄色大片在线观看| 一区二区三区成人| 欧美一区二区视频在线观看2022 | 日韩精品自拍偷拍| 国产精品一区二区久久不卡 | 久久国产视频网| 国产精品入口麻豆原神| 91成人免费在线视频| 日韩成人dvd| 欧美国产一区二区| 欧美日韩视频在线第一区 | 精品国产免费人成电影在线观看四季| 国产毛片精品国产一区二区三区| 国产精品美女久久久久久久久| 色婷婷激情综合| 日本成人在线视频网站| 国产欧美1区2区3区| 欧美在线短视频| 韩国精品在线观看| 亚洲精品免费在线观看| 91精品婷婷国产综合久久性色| 粉嫩13p一区二区三区| 亚洲自拍另类综合| 精品国偷自产国产一区| 91香蕉视频污在线| 久88久久88久久久| 亚洲理论在线观看| 欧美大白屁股肥臀xxxxxx| 99久久国产综合精品麻豆| 日本不卡一二三区黄网| 中文字幕在线一区免费| 91精品国产综合久久久久久久久久| 国产成人在线免费| 日本不卡一区二区三区高清视频| 国产精品久久久久久亚洲伦 | 亚洲欧洲日本在线| 91精品国产欧美日韩| 99国内精品久久| 精品无人区卡一卡二卡三乱码免费卡| 一区二区三区在线看| 久久九九国产精品| 欧美一区二区观看视频| 91看片淫黄大片一级在线观看| 激情图区综合网| 亚洲大型综合色站| 亚洲日本一区二区三区| 久久久久久免费网| 日韩欧美成人一区| 欧美视频一二三区| www.日韩精品| 国产精品资源网| 另类小说图片综合网| 亚洲亚洲精品在线观看| 亚洲日本乱码在线观看| 欧美国产一区二区在线观看| 精品少妇一区二区三区日产乱码| 欧美三级在线看| 色综合久久久久| jlzzjlzz欧美大全| 国产成人精品午夜视频免费| 轻轻草成人在线| 丝袜脚交一区二区| 亚洲成人精品一区| 一区二区在线免费观看| 亚洲欧美视频在线观看视频| 国产精品久久久久久妇女6080| 国产欧美日本一区视频| 久久综合色综合88| 精品乱码亚洲一区二区不卡| 日韩美女视频在线| 日韩一卡二卡三卡四卡| 欧美一卡2卡3卡4卡| 欧美一区二区三区免费观看视频| 欧美二区三区的天堂|