Package com.opensymphony.xwork2.config.entities

Examples of com.opensymphony.xwork2.config.entities.ResultConfig


        if (_actionForwards == null) {
            _actionForwards = new HashMap();
            for (Iterator i = delegate.getGlobalResultConfigs().entrySet().iterator(); i.hasNext();) {
                Map.Entry entry = (Map.Entry) i.next();
                String name = (String) entry.getKey();
                ResultConfig config = (ResultConfig) entry.getValue();
                _actionForwards.put(name, strutsFactory.createActionForward(config));
            }
        }
    }
View Full Code Here


        params.put(resultTypeConfig.getDefaultResultParam(), path);
       
        PackageConfig pkg = configuration.getPackageConfig(defaultPackageName);
        List interceptors = InterceptorBuilder.constructInterceptorReference(pkg, pkg.getFullDefaultInterceptorRef(),
                Collections.EMPTY_MAP, null, objectFactory);
        ResultConfig config = new ResultConfig(Action.SUCCESS, resultTypeConfig.getClazz(), params);
        results.put(Action.SUCCESS, config);
        return new ActionConfig("execute", ActionSupport.class.getName(), defaultPackageName, new HashMap(), results, interceptors);
    }
View Full Code Here

        if (config.getParams() != null) {
            params.putAll(config.getParams());
        }
        params.put(config.getDefaultResultParam(), path);

        ResultConfig resultConfig = new ResultConfig(resultCode, resultClass, params);
        try {
            return objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
        } catch (Exception e) {
            throw new XWorkException("Unable to build codebehind result", e, resultConfig);
        }
View Full Code Here

          method = conditionalParse(method, invocation);
        }

        String resultCode = invocation.getResultCode();
        if (resultCode != null) {
          ResultConfig resultConfig = invocation.getProxy().getConfig().getResults().get(
              resultCode);
          Map resultConfigParams = resultConfig.getParams();
          for (Iterator i = resultConfigParams.entrySet().iterator(); i.hasNext(); ) {
            Map.Entry e = (Map.Entry) i.next();
            if (! prohibitedResultParam.contains(e.getKey())) {
              requestParameters.put(e.getKey().toString(),
                  e.getValue() == null ? "":
View Full Code Here

*/
public class ServletActionRedirectResultTest extends StrutsTestCase {
 
  public void testIncludeParameterInResultWithConditionParseOn() throws Exception {
   
    ResultConfig resultConfig = new ResultConfig();
    resultConfig.addParam("actionName", "someActionName");
    resultConfig.addParam("namespace", "someNamespace");
    resultConfig.addParam("encode", "true");
    resultConfig.addParam("parse", "true");
    resultConfig.addParam("location", "someLocation");
    resultConfig.addParam("prependServletContext", "true");
    resultConfig.addParam("method", "someMethod");
    resultConfig.addParam("param1", "${#value1}");
    resultConfig.addParam("param2", "${#value2}");
    resultConfig.addParam("param3", "${#value3}");
   
   
   
    ActionContext context = ActionContext.getContext();
    ValueStack stack = context.getValueStack();
View Full Code Here

    control.verify();
  }
 
  public void testIncludeParameterInResult() throws Exception {
   
    ResultConfig resultConfig = new ResultConfig();
    resultConfig.addParam("actionName", "someActionName");
    resultConfig.addParam("namespace", "someNamespace");
    resultConfig.addParam("encode", "true");
    resultConfig.addParam("parse", "true");
    resultConfig.addParam("location", "someLocation");
    resultConfig.addParam("prependServletContext", "true");
    resultConfig.addParam("method", "someMethod");
    resultConfig.addParam("param1", "value 1");
    resultConfig.addParam("param2", "value 2");
    resultConfig.addParam("param3", "value 3");
   
    ActionContext context = ActionContext.getContext();
    MockHttpServletRequest req = new MockHttpServletRequest();
    MockHttpServletResponse res = new MockHttpServletResponse();
    context.put(ServletActionContext.HTTP_REQUEST, req);
View Full Code Here

        HashMap successParams = new HashMap();
        successParams.put("propertyName", "executionCount");
        successParams.put("expectedValue", "1");

        ResultConfig successConfig = new ResultConfig(Action.SUCCESS, TestResult.class.getName(), successParams);

        results.put(Action.SUCCESS, successConfig);

        List interceptors = new ArrayList();

        ActionConfig executionCountActionConfig = new ActionConfig(null, ExecutionCountTestAction.class, null, results, interceptors);
        defaultPackageConfig.addActionConfig(EXECUTION_COUNT_ACTION_NAME, executionCountActionConfig);

        results = new HashMap();

        successParams = new HashMap();
        successParams.put("location", "success.jsp");

        successConfig = new ResultConfig(Action.SUCCESS, ServletDispatcherResult.class.getName(), successParams);

        results.put(Action.SUCCESS, successConfig);

        interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));

        ActionConfig testActionConfig = new ActionConfig(null, TestAction.class, null, results, interceptors);
        defaultPackageConfig.addActionConfig(TEST_ACTION_NAME, testActionConfig);

        interceptors = new ArrayList();
        interceptors.add(new InterceptorMapping("token", new TokenInterceptor()));

        results = new HashMap();

        ActionConfig tokenActionConfig = new ActionConfig(null, TestAction.class, null, results, interceptors);
        tokenActionConfig.addResultConfig(new ResultConfig("invalid.token", MockResult.class.getName()));
        tokenActionConfig.addResultConfig(new ResultConfig("success", MockResult.class.getName()));
        defaultPackageConfig.addActionConfig(TOKEN_ACTION_NAME, tokenActionConfig);

        interceptors = new ArrayList();
        interceptors.add(new InterceptorMapping("token-session", new TokenSessionStoreInterceptor()));

        results = new HashMap();

        successParams = new HashMap();
        successParams.put("actionName", EXECUTION_COUNT_ACTION_NAME);

        successConfig = new ResultConfig(Action.SUCCESS, ActionChainResult.class.getName(), successParams);

        results.put(Action.SUCCESS, successConfig);

        // empty results for token session unit test
        results = new HashMap();
        ActionConfig tokenSessionActionConfig = new ActionConfig(null, TestAction.class, null, results, interceptors);
        tokenSessionActionConfig.addResultConfig(new ResultConfig("invalid.token", MockResult.class.getName()));
        tokenSessionActionConfig.addResultConfig(new ResultConfig("success", MockResult.class.getName()));
        defaultPackageConfig.addActionConfig(TOKEN_SESSION_ACTION_NAME, tokenSessionActionConfig);

        configurationManager.addPackageConfig("", defaultPackageConfig);

        Map testActionTagResults = new HashMap();
        testActionTagResults.put(Action.SUCCESS, new ResultConfig(Action.SUCCESS, TestActionTagResult.class.getName(), new HashMap()));
        testActionTagResults.put(Action.INPUT, new ResultConfig(Action.INPUT, TestActionTagResult.class.getName(), new HashMap()));
        ActionConfig testActionTagActionConfig = new ActionConfig((String) null, TestAction.class, (Map) null, testActionTagResults, new ArrayList());
        defaultPackageConfig.addActionConfig("testActionTagAction", testActionTagActionConfig);

        PackageConfig namespacePackageConfig = new PackageConfig("namespacePackage");
        namespacePackageConfig.setNamespace(TEST_NAMESPACE);
View Full Code Here

        public void init(Configuration configuration) throws ConfigurationException {
            PackageConfig wait = new PackageConfig("");

            Map results = new HashMap();
            results.put(Action.SUCCESS, new ResultConfig(Action.SUCCESS, MockResult.class.getName(), null));
            results.put(ExecuteAndWaitInterceptor.WAIT, new ResultConfig(ExecuteAndWaitInterceptor.WAIT, MockResult.class.getName(), null));

            // interceptors
            waitInterceptor = new ExecuteAndWaitInterceptor();
            List interceptors = new ArrayList();
            interceptors.add(new InterceptorMapping("params", new ParametersInterceptor()));
View Full Code Here

        return assertClass("", action_name, class_name);
    }

    protected void assertResult(ActionConfig config, String result_name, String result_value) {
        Map results = config.getResults();
        ResultConfig result = (ResultConfig) results.get(result_name);
        Map params = result.getParams();
        String value = (String) params.get("actionName");
        if (value == null)
            value = (String) params.get("location");
        assertTrue("Wrong result value: [" + value + "]",
                result_value.equals(value));
View Full Code Here

                    LOG.warn("ExecuteAndWait interceptor has detected that no result named 'wait' is available. " +
                            "Defaulting to a plain built-in wait page. It is highly recommend you " +
                            "provide an action-specific or global result named '" + WAIT +
                            "'! This requires FreeMarker support and won't work if you don't have it installed");
                    // no wait result? hmm -- let's try to do dynamically put it in for you!
                    ResultConfig rc = new ResultConfig(WAIT, "org.apache.struts2.views.freemarker.FreemarkerResult",
                            Collections.singletonMap("location", "/org/apache/struts2/interceptor/wait.ftl"));
                    results.put(WAIT, rc);
                }

                return WAIT;
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.config.entities.ResultConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.