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


Java ActionInvocation.getStack方法代码示例

本文整理汇总了Java中com.opensymphony.xwork2.ActionInvocation.getStack方法的典型用法代码示例。如果您正苦于以下问题:Java ActionInvocation.getStack方法的具体用法?Java ActionInvocation.getStack怎么用?Java ActionInvocation.getStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.opensymphony.xwork2.ActionInvocation的用法示例。


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

示例1: intercept

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
@Override
public String intercept(ActionInvocation invocation) throws Exception {
    Object action = invocation.getAction();

    if (action instanceof ModelDriven) {
        ModelDriven modelDriven = (ModelDriven) action;
        ValueStack stack = invocation.getStack();
        Object model = modelDriven.getModel();
        if (model !=  null) {
        	stack.push(model);
        }
        if (refreshModelBeforeResult) {
            invocation.addPreResultListener(new RefreshModelBeforeResult(modelDriven, model));
        }
    }
    return invocation.invoke();
}
 
开发者ID:txazo,项目名称:struts2,代码行数:18,代码来源:ModelDrivenInterceptor.java

示例2: execute

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
@Override
public void execute(ActionInvocation ai) throws Exception {
    ServletActionContext.getResponse().setContentType("text/plain");
    ServletActionContext.getResponse().setCharacterEncoding("utf-8");
    PrintWriter responseStream = ServletActionContext.getResponse().getWriter();
    ValueStack valueStack = ai.getStack();
    String text = (String) valueStack.findValue("textResult");
    responseStream.print(text);
    responseStream.flush();
}
 
开发者ID:robertli0719,项目名称:ZeroSSH,代码行数:11,代码来源:TextResult.java

示例3: handleInvalidToken

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
@Override
 protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
     ActionContext ac = invocation.getInvocationContext();

     HttpServletRequest request = (HttpServletRequest) ac.get(ServletActionContext.HTTP_REQUEST);
     HttpServletResponse response = (HttpServletResponse) ac.get(ServletActionContext.HTTP_RESPONSE);
     String tokenName = TokenHelper.getTokenName();
     String token = TokenHelper.getToken(tokenName);

     if ((tokenName != null) && (token != null)) {
         Map params = ac.getParameters();
         params.remove(tokenName);
         params.remove(TokenHelper.TOKEN_NAME_FIELD);

String sessionTokenName = TokenHelper.buildTokenSessionAttributeName(tokenName);
         ActionInvocation savedInvocation = InvocationSessionStore.loadInvocation(sessionTokenName, token);

         if (savedInvocation != null) {
             // set the valuestack to the request scope
             ValueStack stack = savedInvocation.getStack();
             request.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);

             ActionContext savedContext = savedInvocation.getInvocationContext();
             savedContext.getContextMap().put(ServletActionContext.HTTP_REQUEST, request);
             savedContext.getContextMap().put(ServletActionContext.HTTP_RESPONSE, response);
             Result result = savedInvocation.getResult();

             if ((result != null) && (savedInvocation.getProxy().getExecuteResult())) {
                 result.execute(savedInvocation);
             }

             // turn off execution of this invocations result
             invocation.getProxy().setExecuteResult(false);

             return savedInvocation.getResultCode();
         }
     }

     return INVALID_TOKEN_CODE;
 }
 
开发者ID:txazo,项目名称:struts2,代码行数:41,代码来源:TokenSessionStoreInterceptor.java

示例4: getOverrideExpr

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
protected Object getOverrideExpr(ActionInvocation invocation, Object value) {
    ValueStack stack = invocation.getStack();

    try {
        stack.push(value);

        return escape(stack.findString("top"));
    } finally {
        stack.pop();
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:12,代码来源:StrutsConversionErrorInterceptor.java

示例5: intercept

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
@Override
public String intercept(ActionInvocation invocation) throws Exception {
    ValueStack stack = invocation.getStack();
    CompoundRoot root = stack.getRoot();
    if (shouldCopyStack(invocation, root)) {
        copyStack(invocation, root);
    }
    return invocation.invoke();
}
 
开发者ID:txazo,项目名称:struts2,代码行数:10,代码来源:ChainingInterceptor.java

示例6: beforeResult

import com.opensymphony.xwork2.ActionInvocation; //导入方法依赖的package包/类
public void beforeResult(ActionInvocation invocation, String resultCode) {
    ValueStack stack = invocation.getStack();
    CompoundRoot root = stack.getRoot();

    boolean needsRefresh = true;
    Object newModel = action.getModel();

    // Check to see if the new model instance is already on the stack
    for (Object item : root) {
        if (item.equals(newModel)) {
            needsRefresh = false;
            break;
        }
    }

    // Add the new model on the stack
    if (needsRefresh) {

        // Clear off the old model instance
        if (originalModel != null) {
            root.remove(originalModel);
        }
        if (newModel != null) {
            stack.push(newModel);
        }
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:28,代码来源:ModelDrivenInterceptor.java


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