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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tilesplugin.java

?? struts的源代碼
?? JAVA
字號(hào):
/*
 * $Id: TilesPlugin.java 54929 2004-10-16 16:38:42Z germuska $ 
 *
 * 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.struts.tiles;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.action.RequestProcessor;
import org.apache.struts.config.ControllerConfig;
import org.apache.struts.config.ModuleConfig;
import org.apache.struts.config.PlugInConfig;
import org.apache.struts.util.RequestUtils;

/**
 * Tiles Plugin used to initialize Tiles.
 * This plugin is to be used with Struts 1.1 in association with
 * {@link TilesRequestProcessor}.
 * <br>
 * This plugin creates one definition factory for each Struts-module. The definition factory
 * configuration is read first from 'web.xml' (backward compatibility), then it is
 * overloaded with values found in the plugin property values.
 * <br>
 * The plugin changes the Struts configuration by specifying a {@link TilesRequestProcessor} as
 * request processor. If you want to use your own RequestProcessor,
 * it should subclass TilesRequestProcessor.
 * <br>
 * This plugin can also be used to create one single factory for all modules.
 * This behavior is enabled by specifying <code>moduleAware=false</code> in each
 * plugin properties. In this case, the definition factory
 * configuration file is read by the first Tiles plugin to be initialized. The order is
 * determined by the order of modules declaration in web.xml. The first module
 * is always the default one if it exists.
 * The plugin should be declared in each struts-config.xml file in order to
 * properly initialize the request processor.
 * @since Struts 1.1
 */
public class TilesPlugin implements PlugIn {

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

    /** 
     * Is the factory module aware? 
     */
    protected boolean moduleAware = false;

    /** 
     * Tiles util implementation classname. This property can be set
     * by user in the plugin declaration.
     */
    protected String tilesUtilImplClassname = null;

    /** 
     * Associated definition factory. 
     */
    protected DefinitionsFactory definitionFactory = null;

    /** 
     * The plugin config object provided by the ActionServlet initializing
     * this plugin.
     */
    protected PlugInConfig currentPlugInConfigObject=null;

    /**
     * Get the module aware flag.
     * @return <code>true</code>: user wants a single factory instance,
     * <code>false:</code> user wants multiple factory instances (one per module with Struts)
     */
    public boolean isModuleAware() {
        return moduleAware;
    }

    /**
     * Set the module aware flag.
     * This flag is only meaningful if the property <code>tilesUtilImplClassname</code> is not
     * set.
     * @param moduleAware <code>true</code>: user wants a single factory instance,
     * <code>false:</code> user wants multiple factory instances (one per module with Struts)
     */
    public void setModuleAware(boolean moduleAware) {
        this.moduleAware = moduleAware;
    }

    /**
     * <p>Receive notification that the specified module is being
     * started up.</p>
     *
     * @param servlet ActionServlet that is managing all the modules
     *  in this web application.
     * @param moduleConfig ModuleConfig for the module with which
     *  this plugin is associated.
     *
     * @exception ServletException if this <code>PlugIn</code> cannot
     *  be successfully initialized.
     */
    public void init(ActionServlet servlet, ModuleConfig moduleConfig)
        throws ServletException {
            
        // Create factory config object
        DefinitionsFactoryConfig factoryConfig =
            readFactoryConfig(servlet, moduleConfig);
            
        // Set the module name in the config. This name will be used to compute
        // the name under which the factory is stored.
        factoryConfig.setFactoryName(moduleConfig.getPrefix());
        
        // Set RequestProcessor class
        this.initRequestProcessorClass(moduleConfig);

        this.initTilesUtil();

        this.initDefinitionsFactory(servlet.getServletContext(), moduleConfig, factoryConfig);
    }

    /**
     * Set TilesUtil implementation according to properties 'tilesUtilImplClassname' 
     * and 'moduleAware'.  These properties are taken into account only once. A
     * side effect is that only the values set in the first initialized plugin are 
     * effectively taken into account.
     * @throws ServletException
     */
    private void initTilesUtil() throws ServletException {

        if (TilesUtil.isTilesUtilImplSet()) {
            return;
        }

        // Check if user has specified a TilesUtil implementation classname or not.
        // If no implementation is specified, check if user has specified one
        // shared single factory for all module, or one factory for each module.

        if (this.getTilesUtilImplClassname() == null) {

            if (isModuleAware()) {
                TilesUtil.setTilesUtil(new TilesUtilStrutsModulesImpl());
            } else {
                TilesUtil.setTilesUtil(new TilesUtilStrutsImpl());
            }

        } else { // A classname is specified for the tilesUtilImp, use it.
            try {
                TilesUtilStrutsImpl impl =
                    (TilesUtilStrutsImpl) RequestUtils
                        .applicationClass(getTilesUtilImplClassname())
                        .newInstance();
                TilesUtil.setTilesUtil(impl);

            } catch (ClassCastException ex) {
                throw new ServletException(
                    "Can't set TilesUtil implementation to '"
                        + getTilesUtilImplClassname()
                        + "'. TilesUtil implementation should be a subclass of '"
                        + TilesUtilStrutsImpl.class.getName()
                        + "'");

            } catch (Exception ex) {
                throw new ServletException(
                    "Can't set TilesUtil implementation.",
                    ex);
            }
        }

    }

    /**
     * Initialize the DefinitionsFactory this module will use.
     * @param servletContext
     * @param moduleConfig
     * @param factoryConfig
     * @throws ServletException
     */
    private void initDefinitionsFactory(
        ServletContext servletContext,
        ModuleConfig moduleConfig,
        DefinitionsFactoryConfig factoryConfig)
        throws ServletException {
            
        // Check if a factory already exist for this module
        definitionFactory =
            ((TilesUtilStrutsImpl) TilesUtil.getTilesUtil()).getDefinitionsFactory(
                servletContext,
                moduleConfig);
                
        if (definitionFactory != null) {
            log.info(
                "Factory already exists for module '"
                    + moduleConfig.getPrefix()
                    + "'. The factory found is from module '"
                    + definitionFactory.getConfig().getFactoryName()
                    + "'. No new creation.");
                    
            return;
        }
        
        // Create configurable factory
        try {
            definitionFactory =
                TilesUtil.createDefinitionsFactory(
                    servletContext,
                    factoryConfig);
                    
        } catch (DefinitionsFactoryException ex) {
            log.error(
                "Can't create Tiles definition factory for module '"
                    + moduleConfig.getPrefix()
                    + "'.");
                    
            throw new ServletException(ex);
        }
        
        log.info(
            "Tiles definition factory loaded for module '"
                + moduleConfig.getPrefix()
                + "'.");
    }

    /**
     * End plugin.
     */
    public void destroy() {
        definitionFactory.destroy();
        definitionFactory = null;
    }

    /**
     * Create FactoryConfig and initialize it from web.xml and struts-config.xml.
     *
     * @param servlet ActionServlet that is managing all the modules
     *  in this web application.
     * @param config ModuleConfig for the module with which
     *  this plugin is associated.
     * @exception ServletException if this <code>PlugIn</code> cannot
     *  be successfully initialized.
     */
    protected DefinitionsFactoryConfig readFactoryConfig(
        ActionServlet servlet,
        ModuleConfig config)
        throws ServletException {
            
        // Create tiles definitions config object
        DefinitionsFactoryConfig factoryConfig = new DefinitionsFactoryConfig();
        // Get init parameters from web.xml files
        try {
            DefinitionsUtil.populateDefinitionsFactoryConfig(
                factoryConfig,
                servlet.getServletConfig());
                
        } catch (Exception ex) {
            if (log.isDebugEnabled()){
                log.debug("", ex);
            }
            ex.printStackTrace();
            throw new UnavailableException(
                "Can't populate DefinitionsFactoryConfig class from 'web.xml': "
                    + ex.getMessage());
        }
        
        // Get init parameters from struts-config.xml
        try {
            Map strutsProperties = findStrutsPlugInConfigProperties(servlet, config);
            factoryConfig.populate(strutsProperties);
            
        } catch (Exception ex) {
            if (log.isDebugEnabled()) {
                log.debug("", ex);
            }
                
            throw new UnavailableException(
                "Can't populate DefinitionsFactoryConfig class from '"
                    + config.getPrefix()
                    + "/struts-config.xml':"
                    + ex.getMessage());
        }
        
        return factoryConfig;
    }

    /**
     * Find original properties set in the Struts PlugInConfig object.
     * First, we need to find the index of this plugin. Then we retrieve the array of configs
     * and then the object for this plugin.
     * @param servlet ActionServlet that is managing all the modules
     *  in this web application.
     * @param config ModuleConfig for the module with which
     *  this plug in is associated.
     *
     * @exception ServletException if this <code>PlugIn</code> cannot
     *  be successfully initialized.
     */
    protected Map findStrutsPlugInConfigProperties(
        ActionServlet servlet,
        ModuleConfig config)
        throws ServletException {
            
        return currentPlugInConfigObject.getProperties();
    }

    /**
     * Set RequestProcessor to appropriate Tiles {@link RequestProcessor}.
     * First, check if a RequestProcessor is specified. If yes, check if it extends
     * the appropriate {@link TilesRequestProcessor} class. If not, set processor class to
     * TilesRequestProcessor.
     *
     * @param config ModuleConfig for the module with which
     *  this plugin is associated.
     * @throws ServletException On errors.
     */
    protected void initRequestProcessorClass(ModuleConfig config)
        throws ServletException {
            
        String tilesProcessorClassname = TilesRequestProcessor.class.getName();
        ControllerConfig ctrlConfig = config.getControllerConfig();
        String configProcessorClassname = ctrlConfig.getProcessorClass();

        // Check if specified classname exist
        Class configProcessorClass;
        try {
            configProcessorClass =
                RequestUtils.applicationClass(configProcessorClassname);
                
        } catch (ClassNotFoundException ex) {
            log.fatal(
                "Can't set TilesRequestProcessor: bad class name '"
                    + configProcessorClassname
                    + "'.");
            throw new ServletException(ex);
        }

        // Check if it is the default request processor or Tiles one.
        // If true, replace by Tiles' one.
        if (configProcessorClassname.equals(RequestProcessor.class.getName())
            || configProcessorClassname.endsWith(tilesProcessorClassname)) {
                
            ctrlConfig.setProcessorClass(tilesProcessorClassname);
            return;
        }

        // Check if specified request processor is compatible with Tiles.
        Class tilesProcessorClass = TilesRequestProcessor.class;
        if (!tilesProcessorClass.isAssignableFrom(configProcessorClass)) {
            // Not compatible
            String msg =
                "TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor";
            if (log.isFatalEnabled()) {
                log.fatal(msg);
            }
            throw new ServletException(msg);
        }
    }

    /**
     * Set Tiles util implemention classname.
     * If this property is set, the flag <code>moduleAware</code> will not be used anymore.
     * @param tilesUtilImplClassname Classname.
     */
    public void setTilesUtilImplClassname(String tilesUtilImplClassname) {
        this.tilesUtilImplClassname = tilesUtilImplClassname;
    }
    
    /**
     * Get Tiles util implemention classname.
     * @return The classname or <code>null</code> if none is set.
     */
    public String getTilesUtilImplClassname() {
        return tilesUtilImplClassname;
    }

    /**
     * Method used by the ActionServlet initializing this plugin.
     * Set the plugin config object read from module config.
     * @param plugInConfigObject PlugInConfig.
     */
    public void setCurrentPlugInConfigObject(PlugInConfig plugInConfigObject) {
        this.currentPlugInConfigObject = plugInConfigObject;
    }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲6080在线| 久久亚洲精品小早川怜子| 一区二区三区中文免费| 色久优优欧美色久优优| 亚洲免费av高清| 欧美日韩性生活| 久久黄色级2电影| 国产女同互慰高潮91漫画| 丁香啪啪综合成人亚洲小说| 国产精品女人毛片| 欧美在线综合视频| 美国三级日本三级久久99| 国产欧美中文在线| 欧美亚洲国产怡红院影院| 日韩成人av影视| 国产日韩精品一区二区三区| 日本精品视频一区二区三区| 午夜精品福利一区二区蜜股av | 色先锋aa成人| 偷拍一区二区三区| 国产欧美综合色| 欧美日韩国产小视频在线观看| 免费精品视频在线| 国产精品午夜久久| 欧美精品日韩精品| 成人午夜激情片| 日本亚洲三级在线| 亚洲欧美日韩中文播放| 精品免费一区二区三区| 99re在线精品| 精品一区二区三区av| 亚洲精品免费看| 久久久不卡网国产精品一区| 一本一道久久a久久精品综合蜜臀| 亚洲高清视频中文字幕| 久久精品免费在线观看| 欧美日韩高清一区二区不卡| 国产精品自拍三区| 蜜桃视频在线一区| 亚洲男人天堂av| 国产亚洲人成网站| 91麻豆精品国产91久久久资源速度| 国产米奇在线777精品观看| 亚洲在线成人精品| 久久精品男人的天堂| 欧美一级淫片007| 欧美亚洲尤物久久| 91丨porny丨最新| 成人涩涩免费视频| 蜜臂av日日欢夜夜爽一区| 一区二区在线观看av| 国产女人aaa级久久久级| 日韩精品一区二区三区swag | 欧美三级一区二区| 成人精品视频一区二区三区| 精品一区二区免费看| 日日夜夜一区二区| 午夜精品一区二区三区电影天堂 | 精品国产乱码久久久久久图片| 91免费观看视频| 国产xxx精品视频大全| 免费观看在线综合色| 午夜精品一区在线观看| 午夜一区二区三区在线观看| 亚洲综合在线免费观看| 亚洲色图制服丝袜| 亚洲色图20p| 一区二区免费看| 亚洲激情自拍视频| 一区二区在线观看免费| 亚洲最大色网站| 亚洲一二三专区| 夜夜亚洲天天久久| 樱桃国产成人精品视频| 一区二区视频在线看| 亚洲男女一区二区三区| 亚洲男帅同性gay1069| 亚洲免费在线观看视频| 亚洲欧洲av一区二区三区久久| 国产欧美日韩激情| 国产精品水嫩水嫩| 18涩涩午夜精品.www| 亚洲精品视频在线| 亚洲一卡二卡三卡四卡| 日本成人在线不卡视频| 久久精品国产精品亚洲红杏| 国内外精品视频| 成人精品视频一区| 91久久精品国产91性色tv| 91传媒视频在线播放| 欧美片在线播放| 日韩精品专区在线| 国产亚洲欧美日韩俺去了| 久久久91精品国产一区二区精品| 国产精品素人一区二区| 洋洋av久久久久久久一区| 日韩和欧美一区二区| 韩国v欧美v日本v亚洲v| av中文字幕在线不卡| 欧美日本精品一区二区三区| 日韩欧美美女一区二区三区| 国产欧美一区二区三区鸳鸯浴| 中文字幕免费不卡在线| 亚洲欧美日本韩国| 蜜桃av噜噜一区| 99久久综合色| 91精品国产综合久久久久久漫画| 亚洲色欲色欲www| 日韩主播视频在线| 国产福利视频一区二区三区| 91麻豆免费看片| 欧美一区二区福利视频| 国产精品二三区| 水蜜桃久久夜色精品一区的特点 | 欧美日韩精品三区| 久久久久久久久久久久久夜| 国产精品成人免费| 日韩不卡一区二区| av在线综合网| 日韩一区和二区| 亚洲欧美日韩中文字幕一区二区三区| 丝袜美腿一区二区三区| 成人一区在线观看| 欧美一区三区二区| 国产精品美女久久久久久久| 日韩av中文在线观看| 91麻豆精东视频| 久久蜜桃av一区精品变态类天堂 | 欧美影视一区二区三区| 国产偷国产偷精品高清尤物 | 国产成人精品在线看| 欧美日韩在线精品一区二区三区激情 | 日韩av网站免费在线| 成人av在线播放网址| 精品三级在线看| 午夜精品一区二区三区免费视频 | 成人免费视频免费观看| 日韩一区二区三区高清免费看看| 最近中文字幕一区二区三区| 国精品**一区二区三区在线蜜桃| 欧美图片一区二区三区| 国产精品白丝在线| 成人综合激情网| 久久精品网站免费观看| 国产在线观看一区二区| 日韩视频一区二区在线观看| 亚洲国产视频直播| 在线观看91精品国产入口| 国产精品麻豆欧美日韩ww| 国产一区欧美二区| 欧美大胆一级视频| 日韩电影在线免费观看| 欧美日韩激情在线| 香蕉久久夜色精品国产使用方法| 91丨porny丨国产入口| 国产精品视频一二| 国产不卡一区视频| 国产视频一区在线播放| 国精品**一区二区三区在线蜜桃| 日韩一二三四区| 精品亚洲国内自在自线福利| 精品欧美黑人一区二区三区| 另类专区欧美蜜桃臀第一页| 日韩西西人体444www| 视频一区中文字幕国产| 欧美一区二区三区思思人| 天天操天天干天天综合网| 欧美日韩精品欧美日韩精品一| 亚洲一区二区视频在线| 欧洲精品在线观看| 婷婷夜色潮精品综合在线| 欧美日韩国产乱码电影| 蜜臀精品一区二区三区在线观看| 日韩免费视频一区| 精品一区二区影视| 26uuu成人网一区二区三区| 国产一区二区三区免费在线观看| 精品免费一区二区三区| 国产成人精品免费在线| 国产精品久久久久国产精品日日| 成人免费高清在线| 亚洲男人电影天堂| 欧美精品自拍偷拍| 国产在线麻豆精品观看| 国产精品色在线| 91精品91久久久中77777| 日韩av午夜在线观看| 久久精品视频在线免费观看| av成人免费在线观看| 亚洲电影视频在线| 精品日韩一区二区| 成人美女视频在线观看| 亚洲成av人片在线| 精品免费一区二区三区| 成人性色生活片免费看爆迷你毛片| 亚洲乱码国产乱码精品精的特点 | 午夜欧美大尺度福利影院在线看| 91麻豆精品国产自产在线观看一区 | 日韩欧美国产成人一区二区| 国模套图日韩精品一区二区|