當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。