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

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

?? defaultremoter.java

?? dwr 源文件 dwr 源文件 dwr 源文件
?? JAVA
字號:
/*
 * 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.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.directwebremoting.AccessControl;
import org.directwebremoting.AjaxFilter;
import org.directwebremoting.AjaxFilterChain;
import org.directwebremoting.AjaxFilterManager;
import org.directwebremoting.Call;
import org.directwebremoting.Calls;
import org.directwebremoting.Creator;
import org.directwebremoting.CreatorManager;
import org.directwebremoting.Remoter;
import org.directwebremoting.Replies;
import org.directwebremoting.Reply;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.util.ContinuationUtil;
import org.directwebremoting.util.JavascriptUtil;
import org.directwebremoting.util.LocalUtil;
import org.directwebremoting.util.Logger;

/**
 * In implementation of Remoter that delegates requests to a set of Modules
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public class DefaultRemoter implements Remoter
{
    /* (non-Javadoc)
     * @see org.directwebremoting.Remoter#generateInterfaceScript(java.lang.String, java.lang.String)
     */
    public String generateInterfaceScript(String scriptName, String path) throws SecurityException
    {
        String actualPath = path;
        if (overridePath != null)
        {
            actualPath = overridePath;
        }

        Creator creator = creatorManager.getCreator(scriptName);
        StringBuffer buffer = new StringBuffer();

        buffer.append('\n');
        buffer.append("// Provide a default path to DWREngine\n"); //$NON-NLS-1$
        buffer.append("if (DWREngine == null) { var DWREngine = {}; }\n"); //$NON-NLS-1$
        buffer.append("DWREngine._defaultPath = '" + actualPath + "';\n"); //$NON-NLS-1$ //$NON-NLS-2$
        buffer.append('\n');
        buffer.append("function " + scriptName + "() { }\n"); //$NON-NLS-1$ //$NON-NLS-2$
        buffer.append(scriptName + "._path = '" + actualPath + "';\n"); //$NON-NLS-1$ //$NON-NLS-2$

        Method[] methods = creator.getType().getMethods();
        for (int i = 0; i < methods.length; i++)
        {
            Method method = methods[i];
            String methodName = method.getName();

            // We don't need to check accessControl.getReasonToNotExecute()
            // because the checks are made by the doExec method, but we do check
            // if we can display it
            String reason = accessControl.getReasonToNotDisplay(creator, scriptName, method);
            if (reason != null && !allowImpossibleTests)
            {
                continue;
            }

            // Is it on the list of banned names
            if (JavascriptUtil.isReservedWord(methodName))
            {
                continue;
            }

            // Check to see if the creator is reloadable
            // If it is, then do not cache the generated Javascript
            String script;
            if (!creator.isCacheable())
            {
                script = getMethodJS(scriptName, method);
            }
            else
            {
                String key = scriptName + "." + method.getName(); //$NON-NLS-1$

                // For optimal performance we might synchronize on methodCache however
                // since performance isn't a big issue we are prepared to cope with
                // the off chance that getMethodJS() may be run more than once.
                script = (String) methodCache.get(key);
                if (script == null)
                {
                    script = getMethodJS(scriptName, method);
                    methodCache.put(key, script);
                }
            }

            buffer.append(script);
        }

        return buffer.toString();
    }

    /**
     * Generates Javascript for a given Java method
     * @param scriptName  Name of the Javascript file, sans ".js" suffix
     * @param method Target method
     * @return Javascript implementing the DWR call for the target method
     */
    private String getMethodJS(String scriptName, Method method)
    {
        StringBuffer buffer = new StringBuffer();

        String methodName = method.getName();
        buffer.append(scriptName + '.' + methodName + " = function("); //$NON-NLS-1$
        Class[] paramTypes = method.getParameterTypes();
        for (int j = 0; j < paramTypes.length; j++)
        {
            if (!LocalUtil.isServletClass(paramTypes[j]))
            {
                buffer.append("p" + j + ", "); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }

        buffer.append("callback) {\n"); //$NON-NLS-1$

        buffer.append("  DWREngine._execute(" + scriptName + "._path, '" + scriptName + "', '" + methodName + "\', "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        for (int j = 0; j < paramTypes.length; j++)
        {
            if (LocalUtil.isServletClass(paramTypes[j]))
            {
                buffer.append("false, "); //$NON-NLS-1$
            }
            else
            {
                buffer.append("p" + j + ", "); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }

        buffer.append("callback);\n"); //$NON-NLS-1$
        buffer.append("}\n"); //$NON-NLS-1$

        return buffer.toString();
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.Remoter#execute(org.directwebremoting.Calls)
     */
    public Replies execute(Calls calls)
    {
        Replies replies = new Replies();

        for (int callNum = 0; callNum < calls.getCallCount(); callNum++)
        {
            Call call = calls.getCall(callNum);
            Reply reply = execute(call);
            replies.addReply(reply);
        }

        return replies;
    }

    /**
     * Execute a single call object
     * @param call The call to execute
     * @return A Reply to the Call
     */
    private Reply execute(Call call)
    {
        try
        {
            Method method = call.getMethod();
            if (method == null || call.getException() != null)
            {
                return new Reply(call.getId(), null, call.getException());
            }

            // Get a list of the available matching methods with the coerced
            // parameters that we will use to call it if we choose to use that
            // method.
            Creator creator = creatorManager.getCreator(call.getScriptName());

            // Get ourselves an object to execute a method on unless the
            // method is static
            Object object = null;
            String scope = creator.getScope();
            boolean create = false;

            if (!Modifier.isStatic(method.getModifiers()))
            {
                WebContext webcx = WebContextFactory.get();

                // Check the various scopes to see if it is there
                if (scope.equals(Creator.APPLICATION))
                {
                    object = webcx.getServletContext().getAttribute(call.getScriptName());
                }
                else if (scope.equals(Creator.SESSION))
                {
                    object = webcx.getSession().getAttribute(call.getScriptName());
                }
                else if (scope.equals(Creator.SCRIPT))
                {
                    object = webcx.getScriptSession().getAttribute(call.getScriptName());
                }
                else if (scope.equals(Creator.REQUEST))
                {
                    object = webcx.getHttpServletRequest().getAttribute(call.getScriptName());
                }
                // Creator.PAGE scope means we create one every time anyway

                // If we don't have an object the call the creator
                if (object == null)
                {
                    create = true;
                    object = creator.getInstance();
                }

                // Remember it for next time
                if (create)
                {
                    if (scope.equals(Creator.APPLICATION))
                    {
                        webcx.getServletContext().setAttribute(call.getScriptName(), object);
                    }
                    else if (scope.equals(Creator.SESSION))
                    {
                        webcx.getSession().setAttribute(call.getScriptName(), object);
                    }
                    else if (scope.equals(Creator.SCRIPT))
                    {
                        webcx.getScriptSession().setAttribute(call.getScriptName(), object);
                    }
                    else if (scope.equals(Creator.REQUEST))
                    {
                        webcx.getHttpServletRequest().setAttribute(call.getScriptName(), object);
                    }
                    // Creator.PAGE scope means we create one every time anyway
                }
            }

            // Some debug
            log.info("Exec: " + call.getScriptName() + "." + call.getMethodName() + "()"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            if (log.isDebugEnabled())
            {
                StringBuffer buffer = new StringBuffer();

                if (create)
                {
                    buffer.append("--Object created, "); //$NON-NLS-1$
                    if (!scope.equals(Creator.PAGE))
                    {
                        buffer.append(" stored in "); //$NON-NLS-1$
                        buffer.append(scope);
                    }
                    else
                    {
                        buffer.append(" not stored"); //$NON-NLS-1$
                    }
                }
                else
                {
                    buffer.append("--Object found in "); //$NON-NLS-1$
                    buffer.append(scope);
                }
                buffer.append(". "); //$NON-NLS-1$

                // It would be good to debug the params but it's not easy
                //buffer.append("Call params ("); //$NON-NLS-1$
                //for (int j = 0; j < inctx.getParameterCount(callNum); j++)
                //{
                //    if (j != 0)
                //    {
                //        buffer.append(", "); //$NON-NLS-1$
                //    }
                //    InboundVariable param = inctx.getParameter(callNum, j);
                //    buffer.append(param.toString());
                //}
                //buffer.append(") "); //$NON-NLS-1$

                buffer.append("id="); //$NON-NLS-1$
                buffer.append(call.getId());

                log.debug(buffer.toString());
            }

            // Execute the filter chain method.toString()
            final Iterator it = ajaxFilterManager.getAjaxFilters(call.getScriptName());
            AjaxFilterChain chain = new AjaxFilterChain()
            {
                public Object doFilter(Object obj, Method meth, Object[] p) throws Exception
                {
                    AjaxFilter next = (AjaxFilter) it.next();
                    return next.doFilter(obj, meth, p, this);
                }
            };
            Object reply = chain.doFilter(object, method, call.getParameters());
            return new Reply(call.getId(), reply);
        }
        catch (InvocationTargetException ex)
        {
            // Allow Jetty RequestRetry exception to propogate to container
            ContinuationUtil.rethrowIfContinuation(ex.getTargetException());

            log.warn("Method execution failed: ", ex.getTargetException()); //$NON-NLS-1$
            return new Reply(call.getId(), null, ex.getTargetException());
        }
        catch (Exception ex)
        {
            log.warn("Method execution failed: ", ex); //$NON-NLS-1$
            return new Reply(call.getId(), null, ex);
        }
    }

    /**
     * Accessor for the CreatorManager that we configure
     * @param creatorManager The new ConverterManager
     */
    public void setCreatorManager(CreatorManager creatorManager)
    {
        this.creatorManager = creatorManager;
    }

    /**
     * Accessor for the security manager
     * @param accessControl The accessControl to set.
     */
    public void setAccessControl(AccessControl accessControl)
    {
        this.accessControl = accessControl;
    }

    /**
     * Accessor for the AjaxFilterManager
     * @param ajaxFilterManager The AjaxFilterManager to set.
     */
    public void setAjaxFilterManager(AjaxFilterManager ajaxFilterManager)
    {
        this.ajaxFilterManager = ajaxFilterManager;
    }

    /**
     * If we need to override the default path
     * @param overridePath The new override path
     */
    public void setOverridePath(String overridePath)
    {
        this.overridePath = overridePath;
    }

    /**
     * Do we allow impossible tests for debug purposes
     * @param allowImpossibleTests The allowImpossibleTests to set.
     */
    public void setAllowImpossibleTests(boolean allowImpossibleTests)
    {
        this.allowImpossibleTests = allowImpossibleTests;
    }

    /**
     * What AjaxFilters apply to which Ajax calls?
     */
    private AjaxFilterManager ajaxFilterManager = null;

    /**
     * How we create new beans
     */
    protected CreatorManager creatorManager = null;

    /**
     * The security manager
     */
    protected AccessControl accessControl = null;

    /**
     * If we need to override the default path
     */
    private String overridePath = null;

    /**
     * This helps us test that access rules are being followed
     */
    private boolean allowImpossibleTests = false;

    /**
     * Generated Javascript cache
     */
    private Map methodCache = new HashMap();

    /**
     * The log stream
     */
    private static final Logger log = Logger.getLogger(DefaultRemoter.class);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕中文字幕中文字幕亚洲无线 | 精品免费日韩av| 亚洲成人一二三| 色乱码一区二区三区88| 国产精品久久久久久久久免费樱桃| 国产精品白丝jk黑袜喷水| 久久久久88色偷偷免费| 国产99久久久国产精品潘金网站| 精品久久国产97色综合| 国产一区二区三区日韩| 久久久噜噜噜久久中文字幕色伊伊| 日韩毛片视频在线看| av电影天堂一区二区在线| 一区二区在线观看免费| 欧美在线免费观看亚洲| 亚洲影视资源网| 欧美在线视频不卡| 一区二区在线免费| 538prom精品视频线放| 韩国中文字幕2020精品| 久久精品一区二区三区不卡| 99在线精品一区二区三区| 亚洲国产精品一区二区久久恐怖片 | 91视视频在线观看入口直接观看www| 亚洲欧美色图小说| 欧美一级一区二区| av一区二区三区在线| 日韩精品色哟哟| 国产欧美一区二区三区网站| 欧美日韩高清一区二区| 成人精品视频一区二区三区| 亚洲在线中文字幕| 欧美精品一区男女天堂| 在线一区二区视频| 国产成人av电影在线| 日韩中文字幕麻豆| 亚洲色图在线看| 久久先锋资源网| 欧美电影一区二区三区| 99久久精品免费| 韩国在线一区二区| 亚洲电影视频在线| 最好看的中文字幕久久| 日韩一区二区三区精品视频| 91蜜桃在线免费视频| 国产专区综合网| 污片在线观看一区二区| 亚洲视频一区二区在线| 欧美—级在线免费片| 欧美电影免费观看高清完整版在 | 亚洲一区二区在线免费观看视频| 国产欧美久久久精品影院| 日韩网站在线看片你懂的| 日本大香伊一区二区三区| 成人污污视频在线观看| 国产一区二区三区国产| 久久99精品久久久久久国产越南| 亚洲妇熟xx妇色黄| 亚洲国产一区在线观看| 亚洲日本欧美天堂| 国产精品美女久久久久aⅴ| 26uuu精品一区二区在线观看| 欧美精品aⅴ在线视频| 欧美网站一区二区| 在线免费观看一区| 99re6这里只有精品视频在线观看| 国产一区二区三区不卡在线观看| 蜜臀久久久99精品久久久久久| 午夜成人免费电影| 午夜激情久久久| 日韩国产欧美三级| 五月天视频一区| 爽好多水快深点欧美视频| 亚洲国产aⅴ成人精品无吗| 夜夜嗨av一区二区三区四季av| 亚洲少妇最新在线视频| 亚洲欧美一区二区在线观看| 国产精品久久久久久亚洲伦| 中文在线资源观看网站视频免费不卡| 久久久www成人免费无遮挡大片| 精品国产一区二区三区久久久蜜月| 日韩三级伦理片妻子的秘密按摩| 欧美一区二区三区四区在线观看| 欧美一卡2卡3卡4卡| 欧美电影免费观看完整版| 亚洲精品一区二区三区影院| 欧美激情综合网| 国产精品成人午夜| 一区二区成人在线视频| 亚洲成人精品一区二区| 丝袜亚洲另类欧美综合| 麻豆中文一区二区| 成人精品一区二区三区四区| 91视视频在线直接观看在线看网页在线看| 色综合久久久久久久久久久| 欧美日韩精品是欧美日韩精品| 欧美一区二区三区性视频| 久久免费看少妇高潮| 中文字幕中文字幕一区二区| 亚洲一区二区在线观看视频| 蜜臀久久99精品久久久画质超高清| 国模无码大尺度一区二区三区| 大白屁股一区二区视频| 色综合 综合色| 日韩久久久久久| 国产精品超碰97尤物18| 视频一区二区不卡| 高清国产一区二区三区| 色婷婷激情综合| 欧美一区二区福利视频| 国产精品免费丝袜| 午夜久久久久久| 国产成人免费网站| 欧美日韩一区二区在线观看| 久久一区二区三区四区| 一区二区在线观看免费视频播放| 久久精品99久久久| 色狠狠av一区二区三区| 久久综合给合久久狠狠狠97色69| 亚洲欧美日韩电影| 国精产品一区一区三区mba视频| 一本色道a无线码一区v| 精品国产乱码久久久久久夜甘婷婷 | 欧美理论片在线| 久久精品水蜜桃av综合天堂| 伊人夜夜躁av伊人久久| 国产福利电影一区二区三区| 欧美三日本三级三级在线播放| 久久久久久免费| 青青草国产成人99久久| 色哟哟在线观看一区二区三区| 2022国产精品视频| 亚洲va天堂va国产va久| 91亚洲男人天堂| 国产日韩精品视频一区| 免费日本视频一区| 欧美三日本三级三级在线播放| 国产精品婷婷午夜在线观看| 麻豆一区二区三区| 欧美日韩免费一区二区三区视频| 中文字幕av在线一区二区三区| 免费在线观看一区二区三区| 欧美日韩激情在线| 亚洲精品v日韩精品| 国产不卡视频一区二区三区| 日韩欧美国产系列| 五月天欧美精品| 欧美午夜精品一区二区蜜桃 | 欧美在线一区二区三区| 国产精品国产a级| 成人激情校园春色| 久久九九久久九九| 国产在线观看免费一区| 日韩欧美一区在线| 欧美aa在线视频| 欧美一级在线免费| 全部av―极品视觉盛宴亚洲| 在线观看精品一区| 亚洲一区二区三区四区五区黄 | 日韩成人dvd| 91国产丝袜在线播放| 日韩伦理免费电影| 色婷婷狠狠综合| 一区二区三区蜜桃| 日本高清无吗v一区| 亚洲人成小说网站色在线 | 精品一区二区影视| 精品久久久三级丝袜| 久久99热99| 久久亚洲精华国产精华液| 国产精品一区二区你懂的| 亚洲国产精品ⅴa在线观看| 国产99久久久国产精品免费看| 久久久久久麻豆| av资源网一区| 一区二区三区四区在线| 欧美天堂亚洲电影院在线播放| 亚洲超碰精品一区二区| 欧美成人精品二区三区99精品| 国产在线播放一区三区四| 国产精品美女久久久久高潮| 99久久99精品久久久久久 | 捆绑调教美女网站视频一区| 日韩精品中文字幕一区二区三区 | 久久―日本道色综合久久| 久久激情综合网| 久久精品人人爽人人爽| 一本色道久久综合亚洲91 | 久久久久久久性| 成人免费视频播放| 亚洲男人的天堂一区二区| 在线免费观看成人短视频| 日韩和欧美一区二区三区| 日韩欧美国产精品一区| 国产不卡一区视频| 亚洲综合一区在线| 日韩精品专区在线| jlzzjlzz亚洲女人18| 午夜伊人狠狠久久| 中文天堂在线一区|