当前位置: 首页>>代码示例>>Java>>正文


Java ActionProxy类代码示例

本文整理汇总了Java中com.opensymphony.xwork.ActionProxy的典型用法代码示例。如果您正苦于以下问题:Java ActionProxy类的具体用法?Java ActionProxy怎么用?Java ActionProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ActionProxy类属于com.opensymphony.xwork包,在下文中一共展示了ActionProxy类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAction

import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
/**
 * Get an action from the webwork configuration. The action returned will also execute
 * the interceptors associated with the action
 * @param namespace     Namespace to find the action in
 * @param actionName    Name of action to run (e.g. 'show_tissue_taxonomy') 
 * @param params        Map of parameters to fill the action with
 * @return              Proxy of action to execute
 * @throws Exception
 */
protected ActionProxy getAction(String namespace, String actionName, Map<String,Object> params) throws Exception 
{
    HashMap<String, Map<String, Object>> extraContext = new HashMap<String, Map<String, Object>>();
    extraContext.put(ActionContext.PARAMETERS, params);
    ActionProxy actionProxy = null;
    actionProxy = actionFactory.createActionProxy(namespace, actionName, extraContext);
    
    // Only execute the action, but don't render a result
    
    actionProxy.setExecuteResult(false);
    
    ActionContext context = actionProxy.getInvocation().getInvocationContext();

    context.setSession(new HashMap<String,Object>());

    return actionProxy;
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:27,代码来源:BaseActionTestSuite.java

示例2: getKey

import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
private String getKey(ActionInvocation invocation) {
    ActionProxy proxy = invocation.getProxy();
    if (key == null || "CLASS".equals(key)) {
        return "webwork.ScopeInterceptor:" + proxy.getAction().getClass();
    } else if ("ACTION".equals(key)) {
        return "webwork.ScopeInterceptor:" + proxy.getNamespace() + ":" + proxy.getActionName();
    }
    return key;
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:10,代码来源:SessionAttachmentInterceptor.java

示例3: invokeAction

import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
protected ActionInvocation invokeAction(DispatcherUtils du, HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionDefinition actionDefinition, Map params) throws ServletException
{
    ActionMapping mapping = getActionMapping(actionDefinition, params);
    Map extraContext = du.createContextMap(request, response, mapping, context);

    // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
    OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
    if (null != stack)
    {
        extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
    }

    try
    {
        prepareContinuationAction(request, extraContext);

        ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(actionDefinition.getNamespace(), actionDefinition.getAction(), extraContext, actionDefinition.isExecuteResult(), false);
        proxy.setMethod(actionDefinition.getMethod());
        request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());

        // if the ActionMapping says to go straight to a result, do it!
        if (mapping.getResult() != null)
        {
            Result result = mapping.getResult();
            result.execute(proxy.getInvocation());
        }
        else
        {
            proxy.execute();
        }

        return proxy.getInvocation();
    }
    catch (ConfigurationException ce)
    {
        throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", ce);
    }
    catch (Exception e)
    {
        throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", e);
    }
    finally
    {
        // If there was a previous value stack then set it back onto the request
        if (null != stack)
        {
            request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, stack);
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:51,代码来源:DWRAction.java

示例4: invokeAction

import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
/**
 * 
 */
@SuppressWarnings("unchecked")
protected ActionInvocation invokeAction(DispatcherUtils du, HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionDefinition actionDefinition, Map<String, String> params) throws ServletException
{
    ActionMapping mapping = getActionMapping(actionDefinition, params);
    Map<String, Object> extraContext = du.createContextMap(request, response, mapping, context);

    // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
    OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
    if (null != stack)
    {
        extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
    }

    try
    {
        prepareContinuationAction(request, extraContext);

        ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(actionDefinition.getNamespace(), actionDefinition.getAction(), extraContext, actionDefinition.isExecuteResult(), false);
        proxy.setMethod(actionDefinition.getMethod());
        request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());

        // if the ActionMapping says to go straight to a result, do it!
        if (mapping.getResult() != null)
        {
            Result result = mapping.getResult();
            result.execute(proxy.getInvocation());
        }
        else
        {
            proxy.execute();
        }

        return proxy.getInvocation();
    }
    catch (ConfigurationException ce)
    {
        throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", ce);
    }
    catch (Exception e)
    {
        throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", e);
    }
    finally
    {
        // If there was a previous value stack then set it back onto the request
        if (null != stack)
        {
            request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, stack);
        }
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:55,代码来源:DWRAction.java

示例5: setContributor

import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
protected void setContributor(ActionProxy proxy, int contributorId) {
    ActionContext context = proxy.getInvocation().getInvocationContext();
    context.getSession().put("contributor_id",contributorId);
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:5,代码来源:BaseActionTestSuite.java


注:本文中的com.opensymphony.xwork.ActionProxy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。