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

Java Result类代码示例

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

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



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

示例1: getResult

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
/**
 * If the DefaultActionInvocation has been executed before and the Result is
 * an instance of ActionChainResult, this method will walk down the chain of
 * ActionChainResults until it finds a non-chain result, which will be
 * returned. If the DefaultActionInvocation's result has not been executed
 * before, the Result instance will be created and populated with the result
 * params.
 * 
 * @return a Result instance
 * @throws Exception
 */
@Override
public Result getResult() throws Exception {
	Result returnResult = result;

	// If we've chained to other Actions, we need to find the last result
	while (returnResult instanceof ActionChainResult) {
		ActionProxy aProxy = ((ActionChainResult) returnResult).getProxy();

		if (aProxy != null) {
			Result proxyResult = aProxy.getInvocation().getResult();

			if ((proxyResult != null) && (aProxy.getExecuteResult())) {
				returnResult = proxyResult;
			} else {
				break;
			}
		} else {
			break;
		}
	}

	return returnResult;
}
 
开发者ID:cenobites,项目名称:struts2-json-plugin,代码行数:35,代码来源:JsonActionInvocation.java


示例2: handleInvalidToken

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


示例3: setParameters

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
protected void setParameters(Map<String, Object> extraContext, Result result, Map<String, String> params) {
    for (Map.Entry<String, String> paramEntry : params.entrySet()) {
        try {
            String name = paramEntry.getKey();
            String value = paramEntry.getValue();
            setParameter(result, name, value, extraContext);
        } catch (ReflectionException ex) {
            if (result instanceof ReflectionExceptionHandler) {
                ((ReflectionExceptionHandler) result).handle(ex);
            }
        }
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:14,代码来源:StrutsResultFactory.java


示例4: setParameter

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
protected void setParameter(Result result, String name, String value, Map<String, Object> extraContext) {
    if (result instanceof ParamNameAwareResult) {
        if (((ParamNameAwareResult) result).acceptableParameterName(name, value)) {
            reflectionProvider.setProperty(name, value, result, extraContext, true);
        }
    } else {
        reflectionProvider.setProperty(name, value, result, extraContext, true);
    }
}
 
开发者ID:txazo,项目名称:struts2,代码行数:10,代码来源:StrutsResultFactory.java


示例5: after

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
/**
 * If the result is a redirect then store error and messages in the session.
 */
protected void after(ActionInvocation invocation,
		ValidationAware validationAware)
		throws Exception
{
	Result result = invocation.getResult();

	if (result instanceof ServletRedirectResult
			|| result instanceof ServletActionRedirectResult)
	{
		Map<String, Object> session = invocation.getInvocationContext().getSession();

		Collection<String> actionErrors = validationAware.getActionErrors();
		if (actionErrors != null && actionErrors.size() > 0)
		{
			session.put(ACTION_ERRORS_KEY, actionErrors);
		}

		Collection<String> actionMessages = validationAware.getActionMessages();
		if (actionMessages != null && actionMessages.size() > 0)
		{
			session.put(ACTION_MESSAGES_KEY, actionMessages);
		}

		Map<String, List<String>> fieldErrors = validationAware.getFieldErrors();
		if (fieldErrors != null && fieldErrors.size() > 0)
		{
			session.put(FIELD_ERRORS_KEY, fieldErrors);
		}
	}
}
 
开发者ID:CRFS-bpeng,项目名称:OpenNaaS-0.14-Marketplace,代码行数:34,代码来源:RedirectMessageInterceptor.java


示例6: getResult

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
/**
 * @return The default result
 */
public Result getResult() {
    return result;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:7,代码来源:ActionMapping.java


示例7: setResult

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
/**
 * @param result The result
 */
public void setResult(Result result) {
    this.result = result;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:7,代码来源:ActionMapping.java


示例8: shouldCopyStack

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
private boolean shouldCopyStack(ActionInvocation invocation, CompoundRoot root) throws Exception {
    Result result = invocation.getResult();
    return root.size() > 1 && (result == null || ActionChainResult.class.isAssignableFrom(result.getClass()));
}
 
开发者ID:txazo,项目名称:struts2,代码行数:5,代码来源:ChainingInterceptor.java


示例9: createResult

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
@Override
public Result createResult() throws Exception {
	return super.createResult();
}
 
开发者ID:cenobites,项目名称:struts2-json-plugin,代码行数:5,代码来源:JsonActionInvocation.java


示例10: ActionMapping

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
/**
 * Constructs an ActionMapping with a default result
 *
 * @param result The default result
 */
public ActionMapping(Result result) {
    this.result = result;
}
 
开发者ID:txazo,项目名称:struts2,代码行数:9,代码来源:ActionMapping.java


示例11: buildResult

import com.opensymphony.xwork2.Result; //导入依赖的package包/类
Result buildResult(ResultConfig resultConfig, Map<String, Object> extraContext) throws Exception; 
开发者ID:txazo,项目名称:struts2,代码行数:2,代码来源:ResultFactory.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java WXSoInstallMgrSdk类代码示例发布时间:2022-05-22
下一篇:
Java SubmissionPublisher类代码示例发布时间: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