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

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

?? actionconfigmatcher.java

?? 這是STRUTS1.2。6的開發包。。這是我從芝APACHE網站下下來
?? JAVA
字號:
/*
 * $Id: ActionConfigMatcher.java 54929 2004-10-16 16:38:42Z germuska $ 
 *
 * Copyright 2003,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.config;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.commons.beanutils.BeanUtils;

import org.apache.struts.action.ActionForward;
import org.apache.struts.util.WildcardHelper;

/**
 * Matches paths against pre-compiled wildcard expressions pulled from 
 * action configs. It uses the wildcard matcher from the Apache
 * Cocoon project.
 *
 * @since Struts 1.2
 */
public class ActionConfigMatcher implements Serializable {

    /**  
     * The logging instance 
     */
    private static final Log log =
        LogFactory.getLog(ActionConfigMatcher.class);
        
    /**
     * Handles all wildcard pattern matching.
     */
    private static final WildcardHelper wildcard = new WildcardHelper();
    
    /**  
     * The compiled paths and their associated ActionConfig's 
     */
    private List compiledPaths;

    /**
     *  Finds and precompiles the wildcard patterns from the ActionConfig
     *  "path" attributes.
     *  ActionConfig's will be evaluated in the order they exist in the
     *  Struts config file. Only paths that actually contain a wildcard
     *  will be compiled.
     *
     * @param  configs  An array of ActionConfig's to process
     */
    public ActionConfigMatcher(ActionConfig[] configs) {
        compiledPaths = new ArrayList();
        int[] pattern;
        String path;
        for (int x = 0; x < configs.length; x++) {
            path = configs[x].getPath();
            if (path != null && path.indexOf('*') > -1) {
                if (path.length() > 0 && path.charAt(0) == '/') {
                    path = path.substring(1);
                }
                if (log.isDebugEnabled()) {
                    log.debug("Compiling action config path '" + path + "'");
                }    
                pattern = wildcard.compilePattern(path);
                compiledPaths.add(new Mapping(pattern, configs[x]));
            }    
        }
    }

    /**
     * Matches the path against the compiled wildcard patterns.
     *
     * @param path The portion of the request URI for selecting a config.
     * @return The action config if matched, else null
     */
    public ActionConfig match(String path) {

        ActionConfig config = null;
        if (compiledPaths.size() > 0) {
            if (log.isDebugEnabled()) {
                log.debug("Attempting to match '" + path
                    + "' to a wildcard pattern");
            }    
            if (path.length() > 0 && path.charAt(0) == '/') {
                path = path.substring(1);
            }    
            Mapping m;
            HashMap vars = new HashMap();
            for (Iterator i = compiledPaths.iterator(); i.hasNext();) {
                m = (Mapping) i.next();
                if (wildcard.match(vars, path, m.getPattern())) {
                    config = convertActionConfig(
                            path,
                            (ActionConfig) m.getActionConfig(),
                            vars);
                }
            }
        }    

        return config;
    }
    
    /**
     *  Clones the ActionConfig and its children, replacing various properties
     *  with the values of the wildcard-matched strings.
     *
     * @param  path  The requested path
     * @param  orig  The original ActionConfig
     * @param  vars  A Map of wildcard-matched strings
     * @return       A cloned ActionConfig with appropriate properties replaced
     *      with wildcard-matched values
     */
    protected ActionConfig convertActionConfig(String path, 
            ActionConfig orig, Map vars) {
        ActionConfig config = null;
        
        try {
            config = (ActionConfig) BeanUtils.cloneBean(orig);
        }
        catch (Exception ex) {
            log.warn("Unable to clone action config, recommend not using "
                + "wildcards", ex);
            return null;    
        }
        
        config.setName(convertParam(orig.getName(), vars));
        if (path.length() == 0 || path.charAt(0) != '/') {
            path = "/" + path;
        }    
        config.setPath(path);
        config.setType(convertParam(orig.getType(), vars));
        config.setRoles(convertParam(orig.getRoles(), vars));
        config.setParameter(convertParam(orig.getParameter(), vars));
        config.setAttribute(convertParam(orig.getAttribute(), vars));
        config.setForward(convertParam(orig.getForward(), vars));
        config.setInclude(convertParam(orig.getInclude(), vars));
        config.setInput(convertParam(orig.getInput(), vars));

        ForwardConfig[] fConfigs = orig.findForwardConfigs();
        ForwardConfig cfg;
        for (int x = 0; x < fConfigs.length; x++) {
            cfg = new ActionForward();
            cfg.setContextRelative(fConfigs[x].getContextRelative());
            cfg.setName(fConfigs[x].getName());
            cfg.setPath(convertParam(fConfigs[x].getPath(), vars));
            cfg.setRedirect(fConfigs[x].getRedirect());
            config.removeForwardConfig(fConfigs[x]);
            config.addForwardConfig(cfg);
        }
        
        ExceptionConfig[] exConfigs = orig.findExceptionConfigs();
        for (int x = 0; x < exConfigs.length; x++) {
            config.addExceptionConfig(exConfigs[x]);
        }
        
        config.freeze();
        
        return config;
    }

    /**
     *  Inserts into a value wildcard-matched strings where specified.
     *
     * @param  val   The value to convert
     * @param  vars  A Map of wildcard-matched strings
     * @return       The new value
     */
    protected String convertParam(String val, Map vars) {
        if (val == null) {
            return null;
        } else if (val.indexOf("{") == -1) {
            return val;
        }

        Map.Entry entry;
        StringBuffer key = new StringBuffer("{0}");
        StringBuffer ret = new StringBuffer(val);
        String keyTmp;
        int x;
        for (Iterator i = vars.entrySet().iterator(); i.hasNext();) {
            entry = (Map.Entry) i.next();
            key.setCharAt(1, ((String) entry.getKey()).charAt(0));
            keyTmp = key.toString();
            
            // Replace all instances of the placeholder
            while ((x = ret.toString().indexOf(keyTmp)) > -1) {
                ret.replace(x, x + 3, (String) entry.getValue());
            }
        }
        return ret.toString();
    }

    /**
     *  Stores a compiled wildcard pattern and the ActionConfig it came from.
     */
    private class Mapping implements Serializable {

        /**  The compiled pattern. */
        private int[] pattern;

        /**  The original ActionConfig. */
        private ActionConfig config;

        /**
         *  Contructs a read-only Mapping instance.
         *
         *  @param pattern  The compiled pattern
         *  @param config   The original ActionConfig
         */
        public Mapping(int[] pattern, ActionConfig config) {
            this.pattern = pattern;
            this.config = config;
        }    

        /**
         *  Gets the compiled wildcard pattern.
         *
         *  @return The compiled pattern
         */
        public int[] getPattern() {
            return this.pattern;
        }

        /**
         *  Gets the ActionConfig that contains the pattern.
         *
         *  @return The associated ActionConfig
         */
        public ActionConfig getActionConfig() {
            return this.config;
        }    
    }    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲中国最大av网站| 国产精品色一区二区三区| 天天爽夜夜爽夜夜爽精品视频| 一本到不卡免费一区二区| 亚洲另类在线一区| 欧美三级蜜桃2在线观看| 免费视频一区二区| 久久久久久久久久久电影| 国产成人av资源| 日韩毛片在线免费观看| 欧美性猛交一区二区三区精品| 偷窥少妇高潮呻吟av久久免费| 欧美精品tushy高清| 极品美女销魂一区二区三区 | 中文字幕在线不卡一区二区三区| 99免费精品在线| 亚洲v精品v日韩v欧美v专区| 精品欧美乱码久久久久久| 国产成人免费视频网站| 亚洲视频综合在线| 337p亚洲精品色噜噜| 国产麻豆一精品一av一免费| 亚洲乱码国产乱码精品精小说| 欧美久久久久免费| 国产高清视频一区| 亚洲国产va精品久久久不卡综合| 精品久久久久久久久久久院品网| 成人av网址在线观看| 午夜不卡在线视频| 日本一区二区在线不卡| 欧美日本在线观看| 成人精品鲁一区一区二区| 五月天激情小说综合| 欧美国产欧美综合| 欧美精品 日韩| 成人av在线电影| 免费人成黄页网站在线一区二区| 国产精品福利一区| 欧美成人女星排名| 欧美主播一区二区三区| 国产丶欧美丶日本不卡视频| 亚洲成av人片一区二区| 国产精品每日更新在线播放网址| 欧美精品在线一区二区三区| 99精品国产91久久久久久| 美国毛片一区二区三区| 亚洲专区一二三| 国产精品久久久久一区二区三区共| 久久久91精品国产一区二区精品| 91丨九色丨国产丨porny| 国模娜娜一区二区三区| 视频一区国产视频| 亚洲一区二区三区国产| 日韩伦理av电影| 国产日本欧美一区二区| 精品国产一区二区三区四区四| 欧美美女bb生活片| 色婷婷综合久久久| hitomi一区二区三区精品| 国产在线观看免费一区| 蜜桃av一区二区三区| 亚洲不卡一区二区三区| 亚洲激情中文1区| 中文字幕视频一区二区三区久| 久久综合久久综合久久综合| 日韩欧美一二区| 欧美精品久久久久久久多人混战| 91久久精品一区二区三| 99精品国产一区二区三区不卡| 顶级嫩模精品视频在线看| 国产成人精品亚洲777人妖| 国产高清在线精品| 国产精品66部| 国产福利91精品一区二区三区| 国产精一品亚洲二区在线视频| 韩国三级电影一区二区| 国产伦精品一区二区三区在线观看| 麻豆91在线观看| 久久精品噜噜噜成人av农村| 久久国产精品免费| 国产在线不卡视频| 国产精品亚洲а∨天堂免在线| 国产伦精品一区二区三区免费| 国产在线精品一区二区不卡了| 国产一区二区在线观看免费| 国产主播一区二区| 国产精品中文字幕日韩精品 | 亚洲一区二区视频| 亚洲高清在线视频| 另类人妖一区二区av| 国内成人免费视频| 欧美日韩美少妇| 欧美一区二区三区四区在线观看 | 一个色在线综合| 亚洲一二三区在线观看| 午夜精品久久久| 激情成人综合网| 国产成+人+日韩+欧美+亚洲| 91丨九色丨蝌蚪丨老版| 欧美日韩在线播放一区| 精品少妇一区二区三区日产乱码 | 日本韩国精品在线| 欧美乱妇15p| 精品欧美一区二区三区精品久久| 国产欧美一区二区精品仙草咪| 亚洲欧洲成人精品av97| 性做久久久久久久久| 国产在线不卡一区| 在线日韩av片| 精品国产乱码久久久久久久 | 亚洲欧美二区三区| 亚洲成人精品在线观看| 狠狠色丁香久久婷婷综合丁香| 国产麻豆午夜三级精品| 欧美中文字幕久久| 久久免费精品国产久精品久久久久 | 性做久久久久久免费观看欧美| 久久精品国产77777蜜臀| 成人午夜av在线| 欧美日韩色一区| 亚洲国产电影在线观看| 韩国一区二区三区| 欧洲一区在线电影| 久久久综合九色合综国产精品| 亚洲免费三区一区二区| 国产综合色在线视频区| 欧美日韩一区三区四区| 日本一区二区三区免费乱视频| 亚洲 欧美综合在线网络| 成人av网址在线| 精品久久一二三区| 五月天亚洲婷婷| 99在线精品免费| 久久久久久黄色| 男人的j进女人的j一区| 日本韩国欧美在线| 欧美国产国产综合| 狠狠狠色丁香婷婷综合激情| 欧美日韩一区高清| 亚洲日本乱码在线观看| 国产91精品久久久久久久网曝门 | 国产麻豆91精品| 91精品国产综合久久蜜臀| 亚洲欧美另类小说视频| 成人综合在线网站| 精品日本一线二线三线不卡| 天堂av在线一区| 欧美亚洲综合久久| 亚洲精品视频在线观看免费| 成人av电影在线| 国产精品天美传媒| 成人综合婷婷国产精品久久蜜臀| 欧美mv日韩mv国产网站app| 奇米色777欧美一区二区| 在线一区二区三区四区五区| 亚洲人成网站色在线观看| 成人精品视频网站| 国产精品久久毛片a| 成人精品在线视频观看| 欧美韩日一区二区三区| 成人精品国产一区二区4080| 国产精品私人自拍| 高潮精品一区videoshd| 亚洲国产精品v| 成人理论电影网| 亚洲女人****多毛耸耸8| 97精品久久久久中文字幕 | 国产日韩欧美精品电影三级在线| 久久99精品一区二区三区| 日韩一级在线观看| 久久se精品一区二区| 久久久五月婷婷| 成人黄色电影在线 | 五月天视频一区| 7777精品伊人久久久大香线蕉| 日本视频一区二区| 2欧美一区二区三区在线观看视频| 久久电影网站中文字幕| 久久精品视频免费| 99久久亚洲一区二区三区青草| 亚洲人成网站精品片在线观看| 欧美系列在线观看| 琪琪一区二区三区| 久久久www成人免费无遮挡大片| 国产高清无密码一区二区三区| 国产精品美女视频| 欧美性大战久久久久久久| 久久精品国产一区二区三| 久久久精品日韩欧美| 91免费观看在线| 日本美女一区二区三区视频| 久久精品日韩一区二区三区| 色综合久久综合网欧美综合网| 亚洲成av人片一区二区三区| 欧美成人精品福利| av男人天堂一区| 免费看日韩精品| 亚洲天天做日日做天天谢日日欢| 欧美日本一区二区| 国产成人午夜99999|