Package com.opensymphony.xwork2.config.entities

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


        if (configParams != null) {
          params.putAll(configParams);
        }
        params.putAll(resultParams);

        ResultConfig resultConfig = new ResultConfig.Builder(
            resultName, resultClass).addParams(params)
            .location(DomHelper.getLocationObject(element)).build();
        results.put(resultConfig.getName(), resultConfig);
      }
    }

    return results;
  }
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

                Results results = (Results) actionClass.getAnnotation(Results.class);
                if (results != null) {
                    // first check here...
                    for (int i = 0; i < results.value().length; i++) {
                        Result result = results.value()[i];
                        ResultConfig config = createResultConfig(result);
            if (!containsKey((K)config.getName())) {
                            put((K)config.getName(), (V)config);
                        }
                    }
                }

                // what about a single Result annotation?
                Result result = (Result) actionClass.getAnnotation(Result.class);
                if (result != null) {
                    ResultConfig config = createResultConfig(result);
                    if (!containsKey((K)config.getName())) {
                        put((K)config.getName(), (V)config);
                    }
                }

                actionClass = actionClass.getSuperclass();
            }
View Full Code Here

        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

            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.Builder("", "")
            .addParam("actionName", "someActionName")
            .addParam("namespace", "someNamespace")
            .addParam("encode", "true")
            .addParam("parse", "true")
            .addParam("location", "someLocation")
View Full Code Here

        control.verify();
    }

    public void testIncludeParameterInResult() throws Exception {

        ResultConfig resultConfig = new ResultConfig.Builder("", "")
            .addParam("actionName", "someActionName")
            .addParam("namespace", "someNamespace")
            .addParam("encode", "true")
            .addParam("parse", "true")
            .addParam("location", "someLocation")
View Full Code Here

        control.verify();
    }

    public void testBuildResultWithParameter() throws Exception {

        ResultConfig resultConfig = new ResultConfig.Builder("", ServletActionRedirectResult.class.getName())
            .addParam("actionName", "someActionName")
            .addParam("namespace", "someNamespace")
            .addParam("encode", "true")
            .addParam("parse", "true")
            .addParam("location", "someLocation")
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.Builder(WAIT, "org.apache.struts2.views.freemarker.FreemarkerResult")
                            .addParams(Collections.singletonMap("location", "/org/apache/struts2/interceptor/wait.ftl"))
                            .build();
                    results.put(WAIT, rc);
                }
View Full Code Here

TOP

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

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.