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

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

?? tilespreprocessor.java

?? structs源碼
?? JAVA
字號:
/*
 * $Id: TilesPreProcessor.java 471754 2006-11-06 14:55:09Z husted $
 *
 * 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.tiles.commands;

import java.io.IOException;

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

import org.apache.commons.chain.Command;
import org.apache.commons.chain.Context;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.chain.contexts.ServletActionContext;
import org.apache.struts.config.ForwardConfig;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.ComponentDefinition;
import org.apache.struts.tiles.Controller;
import org.apache.struts.tiles.DefinitionsUtil;
import org.apache.struts.tiles.FactoryNotFoundException;
import org.apache.struts.tiles.NoSuchDefinitionException;
import org.apache.struts.tiles.TilesUtil;
import org.apache.struts.upload.MultipartRequestWrapper;


/**
 * <p>Command class intended to perform responsibilities of the
 * TilesRequestProcessor in Struts 1.1.  Does not actually dispatch requests,
 * but simply prepares the chain context for a later forward as
 * appropriate.  Should be added to a chain before something which
 * would handle a conventional ForwardConfig.</p>
 *
 * <p>This class will never have any effect on the chain unless a
 * <code>TilesDefinitionFactory</code> can be found; however it does not
 * consider the absence of a definition factory to be a fatal error; the
 * command simply returns false and lets the chain continue.</p>
 *
 * <p>To initialize the <code>TilesDefinitionFactory</code>, use
 * <code>org.apache.struts.chain.commands.legacy.TilesPlugin</code>.  This class
 * is a simple extension to <code>org.apache.struts.tiles.TilesPlugin</code>
 * which simply does not interfere with your choice of <code>RequestProcessor</code>
 * implementation.
 *  </p>
 *
 *
 */
public class TilesPreProcessor implements Command
{


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


    private static final Log log = LogFactory.getLog(TilesPreProcessor.class);

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


    /**
     * <p>If the current <code>ForwardConfig</code> is using "tiles",
     * perform necessary pre-processing to set up the <code>TilesContext</code>
     * and substitute a new <code>ForwardConfig</code> which is understandable
     * to a <code>RequestDispatcher</code>.</p>
     *
     * <p>Note that if the command finds a previously existing
     * <code>ComponentContext</code> in the request, then it
     * infers that it has been called from within another tile,
     * so instead of changing the <code>ForwardConfig</code> in the chain
     * <code>Context</code>, the command uses <code>RequestDispatcher</code>
     * to <em>include</em> the tile, and returns true, indicating that the processing
     * chain is complete.</p>
     *
     * @param context The <code>Context</code> for the current request
     *
     * @return <code>false</code> in most cases, but true if we determine
     * that we're processing in "include" mode.
     */
    public boolean execute(Context context) throws Exception {

        // Is there a Tiles Definition to be processed?
        ServletActionContext sacontext = (ServletActionContext) context;
        ForwardConfig forwardConfig = sacontext.getForwardConfig();
        if (forwardConfig == null || forwardConfig.getPath() == null)
        {
            log.debug("No forwardConfig or no path, so pass to next command.");
            return (false);
        }


        ComponentDefinition definition = null;
        try
        {
            definition = TilesUtil.getDefinition(forwardConfig.getPath(),
                    sacontext.getRequest(),
                    sacontext.getContext());
        }
        catch (FactoryNotFoundException ex)
        {
            // this is not a serious error, so log at low priority
            log.debug("Tiles DefinitionFactory not found, so pass to next command.");
            return false;
        }
        catch (NoSuchDefinitionException ex)
        {
            // ignore not found
            log.debug("NoSuchDefinitionException " + ex.getMessage());
        }

        // Do we do a forward (original behavior) or an include ?
        boolean doInclude = false;
        ComponentContext tileContext = null;

        // Get current tile context if any.
        // If context exists, or if the response has already been committed we will do an include
        tileContext = ComponentContext.getContext(sacontext.getRequest());
        doInclude = (tileContext != null || sacontext.getResponse().isCommitted());

        // Controller associated to a definition, if any
        Controller controller = null;

        // Computed uri to include
        String uri = null;

        if (definition != null)
        {
            // We have a "forward config" definition.
            // We use it to complete missing attribute in context.
            // We also get uri, controller.
            uri = definition.getPath();
            controller = definition.getOrCreateController();

            if (tileContext == null) {
                tileContext =
                        new ComponentContext(definition.getAttributes());
                ComponentContext.setContext(tileContext, sacontext.getRequest());

            } else {
                tileContext.addMissing(definition.getAttributes());
            }
        }

        // Process definition set in Action, if any.  This may override the
        // values for uri or controller found using the ForwardConfig, and
        // may augment the tileContext with additional attributes.
        // :FIXME: the class DefinitionsUtil is deprecated, but I can't find
        // the intended alternative to use.
        definition = DefinitionsUtil.getActionDefinition(sacontext.getRequest());
        if (definition != null) { // We have a definition.
                // We use it to complete missing attribute in context.
                // We also overload uri and controller if set in definition.
                if (definition.getPath() != null) {
                    log.debug("Override forward uri "
                              + uri
                              + " with action uri "
                              + definition.getPath());
                        uri = definition.getPath();
                }

                if (definition.getOrCreateController() != null) {
                    log.debug("Override forward controller with action controller");
                        controller = definition.getOrCreateController();
                }

                if (tileContext == null) {
                        tileContext =
                                new ComponentContext(definition.getAttributes());
                        ComponentContext.setContext(tileContext, sacontext.getRequest());
                } else {
                        tileContext.addMissing(definition.getAttributes());
                }
        }


        if (uri == null) {
            log.debug("no uri computed, so pass to next command");
            return false;
        }

        // Execute controller associated to definition, if any.
        if (controller != null) {
            log.trace("Execute controller: " + controller);
            controller.execute(
                    tileContext,
                    sacontext.getRequest(),
                    sacontext.getResponse(),
                    sacontext.getContext());
        }

        // If request comes from a previous Tile, do an include.
        // This allows to insert an action in a Tile.

        if (doInclude) {
            log.info("Tiles process complete; doInclude with " + uri);
            doInclude(sacontext, uri);
        } else {
            log.info("Tiles process complete; forward to " + uri);
            doForward(sacontext, uri);
        }

        log.debug("Tiles processed, so clearing forward config from context.");
        sacontext.setForwardConfig( null );
        return (false);
    }


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

    /**
     * <p>Do an include of specified URI using a <code>RequestDispatcher</code>.</p>
     *
     * @param context a chain servlet/web context
     * @param uri Context-relative URI to include
     */
    protected void doInclude(
        ServletActionContext context,
        String uri)
        throws IOException, ServletException {

        RequestDispatcher rd = getRequiredDispatcher(context, uri);

        if (rd != null) {
            rd.include(context.getRequest(), context.getResponse());
        }
    }

    /**
     * <p>Do an include of specified URI using a <code>RequestDispatcher</code>.</p>
     *
     * @param context a chain servlet/web context
     * @param uri Context-relative URI to include
     */
    protected void doForward(
        ServletActionContext context,
        String uri)
        throws IOException, ServletException {

        RequestDispatcher rd = getRequiredDispatcher(context, uri);

        if (rd != null) {
            rd.forward(context.getRequest(), context.getResponse());
        }
    }

    /**
     * <p>Get the <code>RequestDispatcher</code> for the specified <code>uri</code>.  If it is not found,
     * send a 500 error as a response and return null;
     *
     * @param context the current <code>ServletActionContext</code>
     * @param uri the ServletContext-relative URI of the request dispatcher to find.
     * @return the <code>RequestDispatcher</code>, or null if none is returned from the <code>ServletContext</code>.
     * @throws IOException if <code>getRequestDispatcher(uri)</code> has an error.
     */
    private RequestDispatcher getRequiredDispatcher(ServletActionContext context, String uri) throws IOException {
        RequestDispatcher rd = context.getContext().getRequestDispatcher(uri);
        if (rd == null) {
            log.debug("No request dispatcher found for " + uri);
            HttpServletResponse response = context.getResponse();
            response.sendError(
                HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "Error getting RequestDispatcher for " + uri);
        }
        return rd;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区电影| 亚洲午夜精品网| 欧美日韩一区二区三区四区五区 | heyzo一本久久综合| 久久99国产精品久久| 天堂va蜜桃一区二区三区漫画版| 亚洲精品久久嫩草网站秘色| 亚洲视频 欧洲视频| 欧美国产激情二区三区| 婷婷中文字幕综合| 精品一区二区三区视频在线观看 | 91免费看片在线观看| 99久久精品久久久久久清纯| 99久久99久久综合| 日韩一区二区在线看片| 欧美成人艳星乳罩| 久久综合九色综合欧美就去吻| 久久伊人蜜桃av一区二区| 午夜久久久影院| 欧美亚洲综合久久| 日韩精品一区二区在线| 亚洲一二三区视频在线观看| 激情五月婷婷综合| 成人做爰69片免费看网站| 91在线视频观看| 中文字幕av免费专区久久| 国产精品一区二区三区网站| 91麻豆国产香蕉久久精品| 国产午夜精品一区二区三区视频 | 成人看片黄a免费看在线| 欧美成人艳星乳罩| 麻豆91在线播放免费| 国产成人在线电影| 欧美日韩一区二区欧美激情 | 亚洲第一av色| 国产一区二区三区综合| 一本一道波多野结衣一区二区| 欧美亚洲一区二区在线观看| 成人免费一区二区三区视频 | 18欧美乱大交hd1984| 不卡电影一区二区三区| 欧美一级专区免费大片| 国产精品夫妻自拍| 黄网站免费久久| 久久久久久久久久久黄色| 亚洲超碰精品一区二区| 欧美日韩一区二区三区不卡| 丝袜美腿亚洲色图| 日韩精品一区二区三区视频在线观看 | 美女视频黄频大全不卡视频在线播放| 欧美日韩国产不卡| 国产精品电影一区二区| 91久久香蕉国产日韩欧美9色| 欧美xxxxx裸体时装秀| 国产成人免费视| 最新高清无码专区| 欧美日韩aaa| 国产一区在线精品| 国产精品入口麻豆九色| 国产一区在线观看视频| 中文字幕在线观看不卡| 欧美日韩一级二级三级| 蜜芽一区二区三区| 欧美乱妇20p| 亚洲丰满少妇videoshd| 精品日本一线二线三线不卡| av亚洲精华国产精华| 亚洲午夜免费福利视频| 久久免费看少妇高潮| 91丨porny丨最新| 九九视频精品免费| 亚洲精品成人在线| 久久丝袜美腿综合| 欧美在线啊v一区| 亚洲一级二级三级在线免费观看| 色综合久久久久综合| 美女脱光内衣内裤视频久久网站 | 欧美mv日韩mv国产网站app| 国产不卡视频一区二区三区| 久久蜜桃香蕉精品一区二区三区| 91猫先生在线| 国产一区二区0| 午夜精品久久久久久久蜜桃app| 国产人成一区二区三区影院| 大胆欧美人体老妇| 肉色丝袜一区二区| 综合婷婷亚洲小说| 久久综合精品国产一区二区三区 | 国产精品亚洲成人| 天天免费综合色| 亚洲日本在线天堂| 久久久久久久国产精品影院| 欧美日韩国产小视频在线观看| 成人av网站大全| 激情综合色综合久久| 天天色天天操综合| 亚洲一区免费观看| 亚洲欧美日韩精品久久久久| 91国产精品成人| 成人18精品视频| 国产精品伊人色| 国产在线播放一区三区四| 视频一区二区中文字幕| 亚洲午夜影视影院在线观看| 一区二区三区四区乱视频| 91麻豆精品国产自产在线| 国产一区二区美女| 精品在线亚洲视频| 蜜桃免费网站一区二区三区 | 国产精品理论片在线观看| 精品国产欧美一区二区| 97se亚洲国产综合自在线观| 丁香一区二区三区| 成人丝袜高跟foot| 成人三级在线视频| 成人的网站免费观看| 国产suv精品一区二区6| 国产成人欧美日韩在线电影| 国产精品456| 成人白浆超碰人人人人| 成人av电影在线网| 99精品久久99久久久久| 一本色道a无线码一区v| 色菇凉天天综合网| 欧美天堂一区二区三区| 欧美日韩精品久久久| 69堂成人精品免费视频| 日韩女同互慰一区二区| 精品国产自在久精品国产| 久久久一区二区三区捆绑**| 亚洲国产精品成人综合色在线婷婷| 久久精品一区二区| 中文字幕在线视频一区| 亚洲精品成人天堂一二三| 偷拍一区二区三区四区| 精品一区二区久久久| av综合在线播放| 欧美日韩在线三级| 精品久久久久香蕉网| 欧美韩国一区二区| 亚洲国产精品一区二区久久恐怖片 | 亚洲国产精品一区二区www在线| 午夜电影久久久| 国产一区不卡在线| 91婷婷韩国欧美一区二区| 欧美日韩高清在线播放| 2017欧美狠狠色| 樱花影视一区二区| 美女网站一区二区| av一区二区三区在线| 欧美日韩国产另类一区| 久久网站热最新地址| 曰韩精品一区二区| 狠狠色伊人亚洲综合成人| 91蜜桃视频在线| 欧美xfplay| 依依成人精品视频| 国产一区二区三区免费观看| 91在线视频播放地址| 欧美大白屁股肥臀xxxxxx| 亚洲欧洲av色图| 国产综合色产在线精品| 一道本成人在线| 久久精品一级爱片| 午夜视频在线观看一区| 成人aa视频在线观看| 日韩午夜激情视频| 亚洲黄色av一区| 丁香啪啪综合成人亚洲小说 | av一区二区三区| 精品国产免费人成在线观看| 亚洲综合在线第一页| 国产成人精品aa毛片| 8x8x8国产精品| 中文字幕在线观看不卡视频| 国产一区二区三区在线观看免费视频 | 精一区二区三区| 欧美日韩日日夜夜| 亚洲mv大片欧洲mv大片精品| 成人av小说网| 国产农村妇女毛片精品久久麻豆| 天天综合色天天综合色h| 91在线观看视频| 国产精品久久久久天堂| 国产麻豆精品在线| 日韩欧美第一区| 日欧美一区二区| 欧美日韩二区三区| 一区二区三区高清| 91在线视频在线| 日韩毛片在线免费观看| 国产乱人伦精品一区二区在线观看| 欧美一区二区三区四区久久 | 欧美日韩一级黄| 亚洲第一电影网| 欧美在线观看禁18| 性感美女极品91精品| 欧美三级韩国三级日本一级| 亚洲综合色成人| 欧美美女bb生活片|