Package com.opensymphony.xwork2.config.entities

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


     * @param namespace
     * @param actionName
     * @return The ActionConfig for this action name at this namespace.
     */
    public static ActionConfig getActionConfig(String namespace, String actionName) {
        ActionConfig config = null;
        Map allActionConfigs = getActionConfigs();
        if (allActionConfigs != null) {
            Map actionMappings = (Map) allActionConfigs.get(namespace);
            if (actionMappings != null) {
                config = (ActionConfig) actionMappings.get(actionName);
View Full Code Here


    }

    public static ResultConfig getResultConfig(String namespace, String actionName,
                                               String resultName) {
        ResultConfig result = null;
        ActionConfig actionConfig = getActionConfig(namespace, actionName);
        if (actionConfig != null) {
            Map resultMap = actionConfig.getResults();
            result = (ResultConfig) resultMap.get(resultName);
        }
        return result;
    }
View Full Code Here

     * Assert that an unknown action like /foo maps to ActionSupport with a ServletDispatcherResult to /foo.jsp
     */
    public void testBuildActionConfigForUnknownAction() throws MalformedURLException {
        URL url = new URL("file:/foo.jsp");
        mockServletContext.expectAndReturn("getResource", C.args(C.eq("/foo.jsp")), url);
        ActionConfig actionConfig = handler.handleUnknownAction("/", "foo");
        // we need a package
        assertEquals("codebehind-default", actionConfig.getPackageName());
        // a non-empty interceptor stack
        assertTrue(actionConfig.getInterceptors().size() > 0);
        // ActionSupport as the implementation
        assertEquals(ActionSupport.class.getName(), actionConfig.getClassName());
        // with one result
        assertEquals(1, actionConfig.getResults().size());
        // named success
        assertNotNull(actionConfig.getResults().get("success"));
        // of ServletDispatcherResult type
        assertEquals(ServletDispatcherResult.class.getName(), actionConfig.getResults().get("success").getClassName());
        // and finally pointing to foo.jsp!
        assertEquals("/foo.jsp", actionConfig.getResults().get("success").getParams().get("location"));
    }
View Full Code Here

            SubGraph subGraph = graph.create(namespace);

            Set<String> actionNames = StrutsConfigRetriever.getActionNames(namespace);
            for (String actionName : actionNames) {
                ActionConfig actionConfig = StrutsConfigRetriever.getActionConfig(namespace,
                        actionName);

                ActionNode action = new ActionNode(actionName);
                subGraph.addNode(action);

                Set<String> resultNames = actionConfig.getResults().keySet();
                for (String resultName : resultNames) {
                    ResultConfig resultConfig = actionConfig.getResults().get(resultName);
                    String resultClassName = resultConfig.getClassName();

                    if (resultClassName.equals(ActionChainResult.class.getName())) {

                    } else if (resultClassName.contains("Dispatcher")
View Full Code Here

            }
        }


        ResultTypeConfig defaultResultType = packageLoader.getDefaultResultType(pkgConfig);
        ActionConfig actionConfig = new ActionConfig.Builder(actionPackage, actionName, cls.getName())
                .addResultConfigs(new ResultMap<String,ResultConfig>(cls, actionName, defaultResultType))
                .build();
        pkgConfig.addActionConfig(actionName, actionConfig);
    }
View Full Code Here

        ActionContext ctx = ActionContext.getContext();
        if (outcome != null) {
            if (ctx == null || ctx.getActionInvocation() == null) {
                delegateToParentNavigation(facesContext, fromAction, outcome);
            } else {
                ActionConfig config = ctx.getActionInvocation().getProxy().getConfig();
                Map results = config.getResults();
   
                ResultConfig resultConfig = null;
   
                synchronized (config) {
                    try {
View Full Code Here

        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config");
        assertNotNull(pkg);
        Map configs = pkg.getActionConfigs();
        assertNotNull(configs);
        // assertEquals(1, configs.size());
        ActionConfig actionConfig = (ActionConfig) configs.get("customParentPackage");
        assertNotNull(actionConfig);
    }
View Full Code Here

    public void testParentPackage() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config");
        // assertEquals(2, pkg.getParents().size());
        Map configs = pkg.getActionConfigs();
        ActionConfig config = (ActionConfig) configs.get("customParentPackage");
        assertNotNull(config);
        assertEquals("/custom", pkg.getNamespace());
    }
View Full Code Here

        // assertEquals(2, pkg.getParents().size());
        assertNotNull(pkg);

        assertEquals("custom-package", pkg.getParents().get(0).getName());
        Map configs = pkg.getActionConfigs();
        ActionConfig config = (ActionConfig) configs.get("some");
        assertNotNull(config);
    }
View Full Code Here

    public void testCustomNamespace() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.CustomNamespaceAction");
        Map configs = pkg.getAllActionConfigs();
        // assertEquals(2, configs.size());
        ActionConfig config = (ActionConfig) configs.get("customNamespace");
        assertEquals(config.getPackageName(), pkg.getName());
        assertEquals(1, pkg.getParents().size());
        assertNotNull(config);
        assertEquals("/mynamespace", pkg.getNamespace());
        ActionConfig ac = (ActionConfig) configs.get("customParentPackage");
        assertNotNull(ac);
    }
View Full Code Here

TOP

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

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.