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

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

?? actionconfigmatcher.java

?? struts的源代碼
?? 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一区二区三区免费野_久草精品视频
亚洲欧美日韩人成在线播放| 国产精品1区2区| 欧美日韩一区在线观看| 欧美草草影院在线视频| 欧美日韩在线不卡| 91麻豆精品国产91久久久使用方法 | 日本欧美一区二区三区乱码 | 精品亚洲欧美一区| 日韩免费高清av| 蜜桃免费网站一区二区三区| 精品国产露脸精彩对白| 99精品欧美一区二区蜜桃免费| 亚洲柠檬福利资源导航| 综合网在线视频| 亚洲一区二区中文在线| 91网上在线视频| 欧美日韩高清不卡| 国产精品视频麻豆| 欧美偷拍一区二区| 久久亚洲精精品中文字幕早川悠里 | 欧美在线免费观看视频| 亚洲黄色免费网站| 欧美视频在线观看一区二区| 国产精品一区二区三区四区| 一区二区三区高清| 日韩精品一区二区三区在线观看 | 日本一区二区成人| 欧美日韩国产小视频| 波多野结衣中文字幕一区| 亚洲午夜羞羞片| 国产精品一区二区在线看| 成人动漫一区二区在线| 精品美女在线播放| 福利91精品一区二区三区| www.亚洲免费av| 欧美一区二区三区视频免费播放 | 一区二区免费在线| 亚洲一区二区在线视频| 欧美久久久一区| 欧美理论在线播放| 国产又黄又大久久| 日韩精品91亚洲二区在线观看| 亚洲欧美日韩电影| 国产精品免费av| 精品国产a毛片| 欧美一二区视频| 欧美另类z0zxhd电影| 欧美日韩国产乱码电影| 一本色道亚洲精品aⅴ| 91影视在线播放| 亚洲欧美日韩国产中文在线| 91官网在线免费观看| 亚洲一区在线视频| 成a人片国产精品| 亚洲国产成人在线| 天堂一区二区在线| 国产乱码字幕精品高清av | 午夜电影网亚洲视频| 91成人看片片| 蜜桃精品视频在线| 欧美丰满高潮xxxx喷水动漫| 日韩西西人体444www| 精品国产一区二区精华| 日韩欧美一区电影| 国产精品网站导航| 国产成人av电影在线播放| 东方aⅴ免费观看久久av| 国产精品99久久久久久久女警| 国产激情偷乱视频一区二区三区| 国产日韩精品一区二区浪潮av| 成人免费高清在线观看| 国产欧美1区2区3区| 欧美自拍偷拍一区| 亚洲黄色小视频| 综合久久综合久久| 精品福利一二区| 99re亚洲国产精品| 精品在线免费观看| 亚洲女同一区二区| 国产视频一区二区在线观看| 欧美男同性恋视频网站| 欧美精品久久99| 亚洲欧美激情插| 美腿丝袜亚洲色图| 久久九九99视频| 成人欧美一区二区三区黑人麻豆| 婷婷亚洲久悠悠色悠在线播放| 国产一区激情在线| 666欧美在线视频| 国产精品天干天干在观线| 视频一区欧美精品| 97se亚洲国产综合自在线观| 日韩小视频在线观看专区| 亚洲另类春色校园小说| 国产精品传媒入口麻豆| 欧美视频一区在线| 欧美视频一区在线| 91黄色激情网站| 91免费国产在线| 在线亚洲一区二区| 色综合一个色综合亚洲| 视频一区免费在线观看| 国产成人无遮挡在线视频| 国产精品久久久久久一区二区三区| 国产精品系列在线观看| 亚洲成人精品一区| 亚洲国产一区二区视频| 欧美日韩你懂得| 91久久线看在观草草青青| 午夜精品久久久久久久99樱桃 | 91国偷自产一区二区三区成为亚洲经典| 欧美疯狂做受xxxx富婆| 亚洲欧美日韩国产另类专区| 成人av综合一区| 久久精品日韩一区二区三区| 午夜在线电影亚洲一区| 欧美日韩国产免费一区二区| 一区二区三区四区激情| 欧美在线观看你懂的| 日本欧美一区二区三区| 久久99精品国产麻豆婷婷| 日韩中文字幕91| 亚洲香蕉伊在人在线观| 久久久精品国产免大香伊| 欧美二区在线观看| 日本高清无吗v一区| av在线这里只有精品| 91丨porny丨最新| 制服丝袜中文字幕一区| 精品国产一区二区三区不卡| 国产精品麻豆99久久久久久| 亚洲激情男女视频| 国产精品77777| 免费欧美高清视频| 久久精品一区二区三区av| 欧美一卡2卡3卡4卡| kk眼镜猥琐国模调教系列一区二区| 欧美韩国日本综合| 成人久久18免费网站麻豆 | 欧美老女人第四色| 亚洲一区二区三区四区在线| 欧美日本在线一区| 国产乱人伦偷精品视频免下载| 国产精品传媒视频| 首页国产丝袜综合| 99久久综合99久久综合网站| 精品国产一区二区三区四区四| 亚洲日本丝袜连裤袜办公室| 蜜臀av在线播放一区二区三区| 暴力调教一区二区三区| 色综合天天综合在线视频| 久久精品亚洲国产奇米99| 久久精品亚洲一区二区三区浴池| 欧美猛男gaygay网站| 久久综合色播五月| 国产成人小视频| 精品久久人人做人人爽| 亚洲大片在线观看| 欧美日韩一区不卡| 亚洲精品一区二区三区影院 | 日本在线播放一区二区三区| 久久久综合精品| 欧美吻胸吃奶大尺度电影 | 欧美日韩亚洲综合一区二区三区| 国产精品资源网站| 香蕉成人啪国产精品视频综合网| 欧美在线免费播放| 日韩精品专区在线影院观看| 裸体在线国模精品偷拍| 在线观看精品一区| 亚洲成av人片在线观看无码| 中文字幕一区二区三区四区不卡| 午夜伦理一区二区| 高清在线观看日韩| 久久久噜噜噜久久中文字幕色伊伊| 狠狠色综合日日| 久久久国产精品不卡| 成人激情图片网| 一区二区三区在线免费播放| 欧美一区二区三区视频免费| 久久国产精品免费| 欧美激情在线看| 亚洲成av人片在线观看无码| 国产精品中文字幕一区二区三区| 欧美最猛性xxxxx直播| 欧美激情一区二区三区全黄| 国产一区二区三区高清播放| 国产视频在线观看一区二区三区 | 91精品国产欧美一区二区成人| 欧美日韩精品一二三区| 91高清视频在线| 欧美日韩免费一区二区三区视频| 91蜜桃视频在线| 色综合久久久久| 91成人国产精品| 91精品国产综合久久久久久久 | 中文字幕第一区| 欧美日韩国产综合一区二区三区| 91国偷自产一区二区使用方法| 日韩午夜在线影院|