Package com.opensymphony.xwork2.config.entities

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


   
    public void testCustomActionAnnotation() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.AnnotatedAction");
        Map configs = pkg.getAllActionConfigs();
        // assertEquals(2, configs.size());
        ActionConfig config = (ActionConfig) configs.get("myaction");
        assertNotNull(config);
    }
View Full Code Here


   
    public void testCustomActionAnnotationOfAnyName() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config");
        Map configs = pkg.getAllActionConfigs();
        // assertEquals(2, configs.size());
        ActionConfig config = (ActionConfig) configs.get("myaction2");
        assertNotNull(config);
    }
View Full Code Here

    }
   
    public void testResultAnnotations() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.cltest");
        assertEquals("/cltest", pkg.getNamespace());
        ActionConfig acfg = pkg.getActionConfigs().get("twoResult");
        assertNotNull(acfg);
        assertEquals(2, acfg.getResults().size());
        assertEquals("input.jsp", acfg.getResults().get("input").getParams().get("location"));
        assertEquals("bob", acfg.getResults().get("chain").getParams().get("location"));

        acfg = pkg.getActionConfigs().get("oneResult");
        assertNotNull(acfg);
        assertEquals(1, acfg.getResults().size());
        assertEquals("input-parent.jsp", acfg.getResults().get("input").getParams().get("location"));
    }
View Full Code Here

    }

    public void testActionImplementation() {
        PackageConfig pkg = config.getPackageConfig("org.apache.struts2.config.cltest");
        assertEquals("/cltest", pkg.getNamespace());
        ActionConfig acfg = pkg.getActionConfigs().get("actionImpl");
        assertNotNull(acfg);
    }
View Full Code Here

        }
        return actionNames;
    }

    public ActionConfig getActionConfig(String namespace, String actionName) {
        ActionConfig config = null;
        Map<String, Map<String, ActionConfig>> allActionConfigs = configuration.getRuntimeConfiguration().getActionConfigs();
        if (allActionConfigs != null) {
            Map<String, ActionConfig> actionMappings = allActionConfigs.get(namespace);
            if (actionMappings != null) {
                config = actionMappings.get(actionName);
View Full Code Here

     * @param inv
     *            The action invocation
     * @return True if the JSF interceptors should fire
     */
    protected boolean isFacesAction(ActionInvocation inv) {
        ActionConfig config = inv.getProxy().getConfig();
        if (config != null) {
            ResultConfig resultConfig = config.getResults().get(Action.SUCCESS);
            Class resClass = null;
            try {
                resClass = Class.forName(resultConfig.getClassName());
            } catch (ClassNotFoundException ex) {
                log.warn(
View Full Code Here

        ActionContext ctx = ActionContext.getContext();
        String bundleName = (String) ctx.get(CURRENT_BUNDLE_NAME);
        if (bundleName == null) {
            ActionInvocation inv = ctx.getActionInvocation();
            ActionProxy proxy = inv.getProxy();
            ActionConfig actionConfig = proxy.getConfig();
            bundleName = packageToBundle.get(actionConfig.getPackageName());
        }
        if (bundleName != null) {
            return osgiHost.getActiveBundles().get(bundleName);
        }
        return null;
View Full Code Here

            Result ret = explicitResult;
            explicitResult = null;

            return ret;
        }
        ActionConfig config = proxy.getConfig();
        Map<String, ResultConfig> results = config.getResults();

        ResultConfig resultConfig = null;

        try {
            resultConfig = results.get(resultCode);
View Full Code Here

    }
   
    public ActionConfig handleUnknownAction(String namespace, String actionName)
            throws XWorkException {
        String pathPrefix = determinePath(templatePathPrefix, namespace);
        ActionConfig actionConfig = null;
        for (String ext : resultsByExtension.keySet()) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Trying to locate unknown action template with extension ."+ext+" in directory "+pathPrefix);
            }
            String path = string(pathPrefix, actionName, "." , ext);
View Full Code Here

        /* org.apache.struts2.convention.actions.params */
        pkgConfig = configuration.getPackageConfig("org.apache.struts2.convention.actions.params#struts-default#/params");
        assertNotNull(pkgConfig);
        assertEquals(1, pkgConfig.getActionConfigs().size());
        ActionConfig ac = pkgConfig.getAllActionConfigs().get("actionParam1");
        assertNotNull(ac);
        Map<String, String> params = ac.getParams();
        assertNotNull(params);
        assertEquals(2, params.size());
        assertEquals("val1", params.get("param1"));
        assertEquals("val2", params.get("param2"));

        /* org.apache.struts2.convention.actions.params */
        pkgConfig = configuration.getPackageConfig("org.apache.struts2.convention.actions.exception#struts-default#/exception");
        assertNotNull(pkgConfig);
        assertEquals(2, pkgConfig.getActionConfigs().size());

        ac = pkgConfig.getAllActionConfigs().get("exception1");
        assertNotNull(ac);
        List<ExceptionMappingConfig> exceptions = ac.getExceptionMappings();
        assertNotNull(exceptions);
        assertEquals(2, exceptions.size());
        ExceptionMappingConfig exception = exceptions.get(0);
        assertEquals("NPE1", exception.getExceptionClassName());
        assertEquals("success", exception.getResult());
        exception = exceptions.get(1);
        assertEquals("NPE2", exception.getExceptionClassName());
        assertEquals("success", exception.getResult());
        params = exception.getParams();
        assertNotNull(params);
        assertEquals(1, params.size());
        assertEquals("val1", params.get("param1"));

        ac = pkgConfig.getAllActionConfigs().get("exceptions-action-level");
        assertNotNull(ac);
        exceptions = ac.getExceptionMappings();
        assertNotNull(exceptions);
        assertEquals(2, exceptions.size());
        exception = exceptions.get(0);
        assertEquals("NPE1", exception.getExceptionClassName());
        assertEquals("success", exception.getResult());
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.