Package org.apache.struts2.convention.annotation

Examples of org.apache.struts2.convention.annotation.Action


        // JAVASCRIPT ?
        if (actionName.startsWith("javascript:"))
            return actionName;

        // Init URL Provider
        UrlProvider urlProvider = new ComponentUrlProvider(this, params);
        urlProvider.setHttpServletRequest(request);
        urlProvider.setHttpServletResponse(response);
        urlProvider.setUrlRenderer(urlRenderer);
      // urlProvider.setPortletUrlType(urlType);
        urlProvider.setAction(actionName);
        // render URL
        StringWriter sw = new StringWriter();
        urlRenderer.beforeRenderUrl(urlProvider);
        urlRenderer.renderUrl(sw, urlProvider);
        String url = sw.toString();
View Full Code Here


        // Test with a slash
        PackageConfig packageConfig = createPackageConfigBuilder("/namespace");
        this.conventionsService = new ConventionsServiceImpl("/WEB-INF/location");
        DefaultResultMapBuilder builder = new DefaultResultMapBuilder(context, container, "dispatcher,velocity,freemarker");
        Action actionAnn = OverrideResultAction.class.getMethod("execute").getAnnotation(Action.class);
        Map<String, ResultConfig> results = builder.build(OverrideResultAction.class, actionAnn, "action100", packageConfig);
        ResultConfig result = results.get("error");
        assertNotNull(result);
        assertEquals("/WEB-INF/location/namespace/error-overriden.jsp", result.getParams().get("location"));
    }
View Full Code Here

    protected void buildConfiguration(Set<Class> classes) {
        Map<String, PackageConfig.Builder> packageConfigs = new HashMap<String, PackageConfig.Builder>();

        for (Class<?> actionClass : classes) {
            Actions actionsAnnotation = actionClass.getAnnotation(Actions.class);
            Action actionAnnotation = actionClass.getAnnotation(Action.class);

            // Skip classes that can't be instantiated
            if (cannotInstantiate(actionClass)) {
                if (LOG.isTraceEnabled())
                    LOG.trace("Class [#0] did not pass the instantiation test and will be ignored", actionClass.getName());
View Full Code Here

            Actions actionsAnnotation = method.getAnnotation(Actions.class);
            if (actionsAnnotation != null) {
                List<Action> actions = checkActionsAnnotation(actionsAnnotation);
                map.put(method.getName(), actions);
            } else {
                Action ann = method.getAnnotation(Action.class);
                if (ann != null) {
                    map.put(method.getName(), Arrays.asList(ann));
                }
            }
        }
View Full Code Here

    protected void buildConfiguration(Set<Class> classes) {
        Map<String, PackageConfig.Builder> packageConfigs = new HashMap<String, PackageConfig.Builder>();

        for (Class<?> actionClass : classes) {
            Actions actionsAnnotation = actionClass.getAnnotation(Actions.class);
            Action actionAnnotation = actionClass.getAnnotation(Action.class);

            // Skip classes that can't be instantiated
            if (cannotInstantiate(actionClass)) {
                if (LOG.isTraceEnabled())
                    LOG.trace("Class [#0] did not pass the instantiation test and will be ignored", actionClass.getName());
View Full Code Here

            Actions actionsAnnotation = method.getAnnotation(Actions.class);
            if (actionsAnnotation != null) {
                List<Action> actions = checkActionsAnnotation(actionsAnnotation);
                map.put(method.getName(), actions);
            } else {
                Action ann = method.getAnnotation(Action.class);
                if (ann != null) {
                    map.put(method.getName(), Arrays.asList(ann));
                }
            }
        }
View Full Code Here

    protected void buildConfiguration(Set<Class> classes) {
        Map<String, PackageConfig.Builder> packageConfigs = new HashMap<String, PackageConfig.Builder>();

        for (Class<?> actionClass : classes) {
            Actions actionsAnnotation = actionClass.getAnnotation(Actions.class);
            Action actionAnnotation = actionClass.getAnnotation(Action.class);

            // Skip classes that can't be instantiated
            if (cannotInstantiate(actionClass)) {
                if (LOG.isTraceEnabled())
                    LOG.trace("Class [#0] did not pass the instantiation test and will be ignored", actionClass.getName());
View Full Code Here

            Actions actionsAnnotation = method.getAnnotation(Actions.class);
            if (actionsAnnotation != null) {
                List<Action> actions = checkActionsAnnotation(actionsAnnotation);
                map.put(method.getName(), actions);
            } else {
                Action ann = method.getAnnotation(Action.class);
                if (ann != null) {
                    map.put(method.getName(), Arrays.asList(ann));
                }
            }
        }
View Full Code Here

                }

                // some actions will not have any @Action or a default method, like the rest actions
                // where the action mapper is the one that finds the right method at runtime
                if (map.isEmpty() && mapAllMatches) {
                    Action actionAnnotation = actionClass.getAnnotation(Action.class);
                    createActionConfig(defaultPackageConfig, actionClass, defaultActionName, null, actionAnnotation);
                }
            }
        }
View Full Code Here

                    actions.add(ann);
                }

                map.put(method.getName(), actions);
            } else {
                Action ann = method.getAnnotation(Action.class);
                if (ann != null) {
                    map.put(method.getName(), Arrays.asList(ann));
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.struts2.convention.annotation.Action

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.