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

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

?? dwrxmlconfigurator.java

?? dwr 源文件 dwr 源文件 dwr 源文件
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright 2005 Joe Walker
 *
 * 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.directwebremoting.impl;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

import javax.servlet.ServletContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.directwebremoting.AccessControl;
import org.directwebremoting.AjaxFilter;
import org.directwebremoting.AjaxFilterManager;
import org.directwebremoting.Configurator;
import org.directwebremoting.Container;
import org.directwebremoting.ConverterManager;
import org.directwebremoting.Creator;
import org.directwebremoting.CreatorManager;
import org.directwebremoting.TypeHintContext;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.util.LocalUtil;
import org.directwebremoting.util.LogErrorHandler;
import org.directwebremoting.util.Logger;
import org.directwebremoting.util.Messages;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
 * A configurator that gets its configuration by reading a dwr.xml file.
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public class DwrXmlConfigurator implements Configurator
{
    /**
     * Setter for the resource name that we can use to read a file from the
     * servlet context
     * @param servletResourceName The name to lookup
     * @throws IOException On file read failure
     * @throws ParserConfigurationException On XML setup failure
     * @throws SAXException On XML parse failure
     */
    public void setServletResourceName(String servletResourceName) throws IOException, ParserConfigurationException, SAXException
    {
        this.servletResourceName = servletResourceName;

        ServletContext servletContext = WebContextFactory.get().getServletContext();
        if (servletContext == null)
        {
            throw new IOException(Messages.getString("DwrXmlConfigurator.MissingServletContext")); //$NON-NLS-1$
        }

        InputStream in = null;
        try
        {
            in = servletContext.getResourceAsStream(servletResourceName);
            if (in == null)
            {
                throw new IOException(Messages.getString("DwrXmlConfigurator.MissingConfigFile", servletResourceName)); //$NON-NLS-1$
            }

            setInputStream(in);
        }
        finally
        {
            LocalUtil.close(in);
        }
    }

    /**
     * Setter for a classpath based lookup
     * @param classResourceName The resource to lookup in the classpath
     * @throws IOException On file read failure
     * @throws ParserConfigurationException On XML setup failure
     * @throws SAXException On XML parse failure
     */
    public void setClassResourceName(String classResourceName) throws IOException, ParserConfigurationException, SAXException
    {
        this.classResourceName = classResourceName;

        InputStream in = getClass().getResourceAsStream(classResourceName);
        if (in == null)
        {
            throw new IOException(Messages.getString("DwrXmlConfigurator.MissingConfigFile", classResourceName)); //$NON-NLS-1$
        }

        setInputStream(in);
    }

    /**
     * Setter for a direct input stream to configure from
     * @param in The input stream to read from.
     * @throws IOException On file read failure
     * @throws ParserConfigurationException On XML setup failure
     * @throws SAXException On XML parse failure
     */
    public void setInputStream(InputStream in) throws ParserConfigurationException, SAXException, IOException
    {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setValidating(true);

        DocumentBuilder db = dbf.newDocumentBuilder();
        db.setEntityResolver(new DTDEntityResolver());
        db.setErrorHandler(new LogErrorHandler());

        document = db.parse(in);
    }

    /**
     * To set the configuration document directly
     * @param document The new configuration document
     */
    public void setDocument(Document document)
    {
        this.document = document;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.Configurator#configure(org.directwebremoting.Container)
     */
    public void configure(Container container)
    {
        accessControl = (AccessControl) container.getBean(AccessControl.class.getName());
        ajaxFilterManager = (AjaxFilterManager) container.getBean(AjaxFilterManager.class.getName());
        converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName());
        creatorManager = (CreatorManager) container.getBean(CreatorManager.class.getName());

        Element root = document.getDocumentElement();

        NodeList rootChildren = root.getChildNodes();
        for (int i = 0; i < rootChildren.getLength(); i++)
        {
            Node node = rootChildren.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE)
            {
                Element child = (Element) node;

                if (child.getNodeName().equals(ELEMENT_INIT))
                {
                    loadInits(child);
                }
                else if (child.getNodeName().equals(ELEMENT_ALLOW))
                {
                    loadAllows(child);
                }
                else if (child.getNodeName().equals(ELEMENT_SIGNATURES))
                {
                    loadSignature(child);
                }
            }
        }
    }

    /**
     * Internal method to load the inits element
     * @param child The element to read
     */
    private void loadInits(Element child)
    {
        NodeList inits = child.getChildNodes();
        for (int j = 0; j < inits.getLength(); j++)
        {
            if (inits.item(j).getNodeType() == Node.ELEMENT_NODE)
            {
                Element initer = (Element) inits.item(j);

                if (initer.getNodeName().equals(ATTRIBUTE_CREATOR))
                {
                    String id = initer.getAttribute(ATTRIBUTE_ID);
                    String className = initer.getAttribute(ATTRIBUTE_CLASS);
                    creatorManager.addCreatorType(id, className);
                }
                else if (initer.getNodeName().equals(ATTRIBUTE_CONVERTER))
                {
                    String id = initer.getAttribute(ATTRIBUTE_ID);
                    String className = initer.getAttribute(ATTRIBUTE_CLASS);
                    converterManager.addConverterType(id, className);
                }
            }
        }
    }

    /**
     * Internal method to load the create/convert elements
     * @param child The element to read
     */
    private void loadAllows(Element child)
    {
        NodeList allows = child.getChildNodes();
        for (int j = 0; j < allows.getLength(); j++)
        {
            if (allows.item(j).getNodeType() == Node.ELEMENT_NODE)
            {
                Element allower = (Element) allows.item(j);

                if (allower.getNodeName().equals(ELEMENT_CREATE))
                {
                    loadCreate(allower);
                }
                else if (allower.getNodeName().equals(ELEMENT_CONVERT))
                {
                    loadConvert(allower);
                }
                else if (allower.getNodeName().equals(ELEMENT_FILTER))
                {
                    loadFilter(allower);
                }
            }
        }
    }

    /**
     * Internal method to load the convert element
     * @param allower The element to read
     */
    private void loadConvert(Element allower)
    {
        String match = allower.getAttribute(ATTRIBUTE_MATCH);
        String type = allower.getAttribute(ATTRIBUTE_CONVERTER);

        try
        {
            Map params = createSettingMap(allower);
            converterManager.addConverter(match, type, params);
        }
        catch (NoClassDefFoundError ex)
        {
            log.info("Convertor '" + type + "' not loaded due to NoClassDefFoundError. (match='" + match + "'). Cause: " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        catch (Exception ex)
        {
            log.error("Failed to add convertor: match=" + match + ", type=" + type, ex); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    /**
     * Internal method to load the create element
     * @param allower The element to read
     */
    private void loadCreate(Element allower)
    {
        String type = allower.getAttribute(ATTRIBUTE_CREATOR);
        String javascript = allower.getAttribute(ATTRIBUTE_JAVASCRIPT);

        try
        {
            Map params = createSettingMap(allower);
            creatorManager.addCreator(javascript, type, params);

            processPermissions(javascript, allower);
            processAuth(javascript, allower);
            processParameters(javascript, allower);
            processAjaxFilters(javascript, allower);
        }
        catch (NoClassDefFoundError ex)
        {
            log.info("Creator '" + type + "' not loaded due to NoClassDefFoundError. (javascript='" + javascript + "'). Cause: " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        catch (Exception ex)
        {
            log.error("Failed to add creator: type=" + type + ", javascript=" + javascript, ex); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    /**
     * Internal method to load the convert element
     * @param allower The element to read
     */
    private void loadFilter(Element allower)
    {
        String type = allower.getAttribute(ATTRIBUTE_CLASS);

        try
        {
            Class impl = LocalUtil.classForName(type);
            AjaxFilter object = (AjaxFilter) impl.newInstance();

            LocalUtil.setParams(object, createSettingMap(allower), ignore);

            ajaxFilterManager.addAjaxFilter(object);
        }
        catch (ClassCastException ex)
        {
            log.error(type + " does not implement " + AjaxFilter.class.getName(), ex); //$NON-NLS-1$
        }
        catch (NoClassDefFoundError ex)
        {
            log.info("Missing class for filter (class='" + type + "'). Cause: " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
        }
        catch (Exception ex)
        {
            log.error("Failed to add filter: class=" + type, ex); //$NON-NLS-1$
        }
    }

    /**
     * Create a parameter map from nested <param name="foo" value="blah"/>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲综合久久久久| 国产精品12区| 国产精品一二三| 色婷婷久久99综合精品jk白丝| 精品久久久三级丝袜| 亚洲黄色免费网站| 国产成人aaa| 欧美tk—视频vk| 亚洲影院理伦片| 99精品视频在线免费观看| 欧美一级日韩一级| 亚洲一区中文日韩| 91在线porny国产在线看| 久久蜜臀精品av| 美女视频一区在线观看| 欧美日韩精品久久久| 亚洲视频在线观看一区| 国产传媒欧美日韩成人| 欧美大片免费久久精品三p| 亚洲第一在线综合网站| 日本精品一区二区三区高清| 国产精品久久免费看| 国产精品综合久久| 久久久亚洲精华液精华液精华液 | 精品一区二区综合| 欧美无砖专区一中文字| 亚洲精品欧美激情| av激情成人网| 国产精品色哟哟网站| 大白屁股一区二区视频| 国产精品成人免费精品自在线观看| 九九在线精品视频| 精品剧情在线观看| 国产高清不卡一区| 欧美极品美女视频| 成人av在线播放网站| 国产精品福利影院| 在线免费一区三区| 无码av中文一区二区三区桃花岛| 欧美日韩免费视频| 午夜精品久久久久久久久久| 日韩一区二区视频| 国产一区二区三区免费观看| 亚洲国产岛国毛片在线| 99精品国产一区二区三区不卡| 悠悠色在线精品| 欧美精品在线一区二区三区| 日韩成人一区二区| 国产亚洲女人久久久久毛片| aaa亚洲精品一二三区| 亚洲激情成人在线| 日韩午夜在线影院| 国产91丝袜在线18| 一区二区三区免费在线观看| 欧美日韩不卡一区二区| 国产乱淫av一区二区三区| 中文字幕在线观看不卡视频| 91高清在线观看| 久久精品国产免费看久久精品| 久久久蜜臀国产一区二区| 99久久久久久99| 视频一区欧美日韩| 久久蜜臀中文字幕| 欧美在线视频不卡| 国内不卡的二区三区中文字幕 | 欧美sm美女调教| av一区二区三区在线| 性做久久久久久免费观看| 亚洲精品在线观| 91免费国产在线| 另类的小说在线视频另类成人小视频在线 | 欧美tickling挠脚心丨vk| 成人福利在线看| 午夜精品福利一区二区三区av| 久久久久久久久久美女| 日本电影欧美片| 国产一区二区在线免费观看| 亚洲精品伦理在线| 久久久久久97三级| 欧美一区二区日韩一区二区| eeuss国产一区二区三区| 看国产成人h片视频| 亚洲欧美偷拍卡通变态| 精品国产一区二区在线观看| 欧美综合视频在线观看| 成人午夜av电影| 精品午夜久久福利影院 | 91.com视频| 99视频精品全部免费在线| 激情都市一区二区| 五月天欧美精品| 亚洲在线视频一区| 亚洲天堂免费看| 国产精品欧美一区二区三区| 精品福利av导航| 日韩欧美国产小视频| 欧美人与性动xxxx| 欧美在线免费视屏| 91同城在线观看| 国产白丝网站精品污在线入口| 麻豆精品视频在线观看免费 | 国产成人av一区| 美国毛片一区二区三区| 午夜精品福利一区二区三区蜜桃| 亚洲欧美日韩综合aⅴ视频| 亚洲国产精品精华液ab| 国产日韩成人精品| 26uuu色噜噜精品一区二区| 欧美tk丨vk视频| 久久久91精品国产一区二区三区| 欧美变态tickle挠乳网站| 8x福利精品第一导航| 欧美三级视频在线播放| 欧美日韩在线观看一区二区| 在线国产电影不卡| 欧美视频一区二区三区四区| 欧美性受xxxx黑人xyx性爽| 欧美亚一区二区| 欧美日韩久久久久久| 日韩一区二区三区在线| 日韩欧美国产一区在线观看| 欧美精品一区二区久久婷婷 | 成年人网站91| youjizz久久| 在线免费观看不卡av| 欧美日韩另类一区| 日韩欧美中文字幕精品| 欧美精品一区二区三区在线| 精品裸体舞一区二区三区| 国产清纯白嫩初高生在线观看91 | 亚洲精品网站在线观看| 亚洲精品乱码久久久久久| 亚洲bt欧美bt精品777| 欧美96一区二区免费视频| 国内久久精品视频| 成人性色生活片免费看爆迷你毛片| 成人黄色一级视频| 欧美中文字幕一二三区视频| 7777精品伊人久久久大香线蕉经典版下载 | 性做久久久久久久久| 日韩精品成人一区二区三区| 美女精品自拍一二三四| 国产91丝袜在线播放九色| 一本大道久久a久久精二百| 欧美日韩黄色影视| 国产亚洲视频系列| 亚洲在线视频网站| 国产美女视频91| 在线精品观看国产| 精品国产精品一区二区夜夜嗨| 国产精品色呦呦| 日韩精品高清不卡| 成人黄色软件下载| 51久久夜色精品国产麻豆| 国产精品视频第一区| 蜜臀av亚洲一区中文字幕| 成人av免费网站| 精品成人a区在线观看| 樱花草国产18久久久久| 国产一区二区三区在线观看免费视频| 91色porny在线视频| 精品处破学生在线二十三| 亚洲成人精品在线观看| 国产精品自拍在线| 3751色影院一区二区三区| 亚洲精品自拍动漫在线| 国产精品主播直播| 欧美一三区三区四区免费在线看| 国产精品成人一区二区三区夜夜夜| 美女一区二区久久| 欧美群妇大交群中文字幕| 国产精品久久毛片a| 国产麻豆一精品一av一免费| 欧美女孩性生活视频| 亚洲欧美日韩国产成人精品影院| 国产在线播精品第三| 欧美一区二区观看视频| 亚洲高清视频在线| 91网站黄www| 亚洲欧洲成人精品av97| 国产一区二区导航在线播放| 日韩视频在线一区二区| 天堂va蜜桃一区二区三区漫画版| a级精品国产片在线观看| 久久影音资源网| 久久国产福利国产秒拍| 在线电影欧美成精品| 亚洲影院在线观看| 日本韩国一区二区三区视频| 中文字幕一区二区三区视频| 成人一区二区在线观看| 国产午夜精品一区二区| 国产一区二区三区免费| 精品国产乱码久久久久久1区2区| 免费看日韩精品| 日韩美一区二区三区| 国产乱码字幕精品高清av| 欧美成人aa大片| 久久精品国产99久久6| 欧美电影免费观看高清完整版在|