• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ActionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prepareContinuationAction

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
/**
 * 
 */
@SuppressWarnings("unchecked")
protected void prepareContinuationAction(HttpServletRequest request, Map<String, Object> extraContext)
{
    String id = request.getParameter(XWorkContinuationConfig.CONTINUE_PARAM);
    if (null != id)
    {
        // remove the continue key from the params - we don't want to bother setting
        // on the value stack since we know it won't work. Besides, this breaks devMode!
        Map<String, String> params = (Map<String, String>) extraContext.get(ActionContext.PARAMETERS);
        params.remove(XWorkContinuationConfig.CONTINUE_PARAM);

        // and now put the key in the context to be picked up later by XWork
        extraContext.put(XWorkContinuationConfig.CONTINUE_KEY, id);
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:19,代码来源:DWRAction.java


示例2: getAction

import com.opensymphony.xwork.ActionContext; //导入依赖的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


示例3: prepareContinuationAction

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
protected void prepareContinuationAction(HttpServletRequest request, Map extraContext)
{
    String id = request.getParameter(XWorkContinuationConfig.CONTINUE_PARAM);
    if (null != id)
    {
        // remove the continue key from the params - we don't want to bother setting
        // on the value stack since we know it won't work. Besides, this breaks devMode!
        Map params = (Map) extraContext.get(ActionContext.PARAMETERS);
        params.remove(XWorkContinuationConfig.CONTINUE_PARAM);

        // and now put the key in the context to be picked up later by XWork
        extraContext.put(XWorkContinuationConfig.CONTINUE_KEY, id);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:DWRAction.java


示例4: before

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
protected void before(ActionInvocation invocation) throws Exception 
{
    // have params?
    if (!(invocation.getAction() instanceof NoParameters)) 
    {
        // yes
        ActionContext t_objContext = invocation.getInvocationContext();
        final Map t_mapParameter = t_objContext.getParameters();
        
        if (t_mapParameter != null) 
        {
            Map t_objContextMap = t_objContext.getContextMap();
            try 
            {
                OgnlContextState.setCreatingNullObjects(t_objContextMap, true);
   //             OgnlContextState.setDenyMethodExecution(t_objContextMap, true);
                OgnlContextState.setReportingConversionErrors(t_objContextMap, true);
                
                OgnlValueStack stack = t_objContext.getValueStack();
                if ( t_mapParameter.containsKey("pageFrom"))
                {
                    Object value = t_mapParameter.get("pageFrom");
                    stack.setValue("pageFrom", value);
                }
            } 
            finally 
            {
                OgnlContextState.setCreatingNullObjects(t_objContextMap, false);
     //           OgnlContextState.setDenyMethodExecution(t_objContextMap, false);
                OgnlContextState.setReportingConversionErrors(t_objContextMap, false);
            }
        }
    }
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:35,代码来源:PageFromParameterInterceptor.java


示例5: doSearch

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
@Override
public String doSearch() {
    // noinspection unchecked
    ActionContext.getContext().getSession().put("confluence.user.dir.search.string", getQueryString());
    final Report report = getEffectiveReport();
    _reports = determinateReports();
    _columns = determinateModelsFor(report);
    _profiles = searchFor(report, _columns);
    return "success";
}
 
开发者ID:echocat,项目名称:adam,代码行数:11,代码来源:ExtendedPeopleDirectoryAction.java


示例6: resolveLocale

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
/**
 * @see LocaleResolver#resolveLocale(PageContext)
 */
@Override
public Locale resolveLocale(PageContext pageContext)
{

    Locale result = null;
    OgnlValueStack stack = ActionContext.getContext().getValueStack();

    Iterator<Object> iterator = stack.getRoot().iterator();
    while (iterator.hasNext())
    {
        Object o = iterator.next();

        if (o instanceof LocaleProvider)
        {
            LocaleProvider lp = (LocaleProvider) o;
            result = lp.getLocale();

            break;
        }
    }

    if (result == null)
    {
        log.debug("Missing LocalProvider actions, init locale to default");
        result = Locale.getDefault();
    }

    return result;
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:33,代码来源:I18nWebworkAdapter.java


示例7: invokeAction

import com.opensymphony.xwork.ActionContext; //导入依赖的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


示例8: invokeAction

import com.opensymphony.xwork.ActionContext; //导入依赖的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


示例9: getSessionMap

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
private Map getSessionMap() {
    return (Map) ActionContext.getContext().get("session");
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:4,代码来源:InsertionQueue.java


示例10: setContributor

import com.opensymphony.xwork.ActionContext; //导入依赖的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


示例11: before

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
protected void before(ActionInvocation invocation) throws Exception 
{
    // have params?
    if (!(invocation.getAction() instanceof NoParameters)) 
    {
        // yes
        ActionContext t_objContext = invocation.getInvocationContext();
        final Map t_mapParameter = t_objContext.getParameters();
        
        if (t_mapParameter != null) 
        {
            Map t_objContextMap = t_objContext.getContextMap();
            try 
            {
                OgnlContextState.setCreatingNullObjects(t_objContextMap, true);
                OgnlContextState.setDenyMethodExecution(t_objContextMap, true);
                OgnlContextState.setReportingConversionErrors(t_objContextMap, true);
                
                OgnlValueStack t_objStack = t_objContext.getValueStack();
                boolean t_bFoundOne = false;
                Set t_objSet = t_mapParameter.keySet();
                HashMap<String,String[]> t_hashParameter = new HashMap<String,String[]>();
                String t_strHashKey = "";
                if ( t_objSet != null )
                {
                    for (Iterator t_iterKey = t_objSet.iterator(); t_iterKey.hasNext();)
                    {
                        String t_objKey = (String) t_iterKey.next();
                        if ( t_objKey.startsWith(this.m_strHashTag) )
                        {
                            String[] t_objValue = (String[]) t_mapParameter.get(t_objKey);
                            t_strHashKey = t_objKey.substring(this.m_strHashTag.length()+1);
                            t_hashParameter.put(t_strHashKey,t_objValue);
                            t_bFoundOne = true;
                        }
                    }
                }
                if ( t_bFoundOne )
                {
                    t_objStack.setValue(this.m_strExecuteMethode,t_hashParameter);
                }
            } 
            finally 
            {
                OgnlContextState.setCreatingNullObjects(t_objContextMap, false);
                OgnlContextState.setDenyMethodExecution(t_objContextMap, false);
                OgnlContextState.setReportingConversionErrors(t_objContextMap, false);
            }
        }
    }
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:52,代码来源:HashParameterInterceptor.java


示例12: getCurrentActionName

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
/************************************
*
*   Returns the name of the currently-running action.
*
*   @see Eurocarb#getProperties()
*/
public String getCurrentActionName()
{
    return ActionContext.getContext().getName();   
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:11,代码来源:EurocarbAction.java


示例13: getCurrentActionNamespace

import com.opensymphony.xwork.ActionContext; //导入依赖的package包/类
/*******************************
*
*   Returns the namespace of the currently-running action.
*
*   @see Eurocarb#getProperties()
*/
public String getCurrentActionNamespace()
{
    return ActionContext.getContext().getName();   
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:11,代码来源:EurocarbAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessageFormatRuntimeException类代码示例发布时间:2022-05-22
下一篇:
Java TriggerDef类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap