Package net.sourceforge.stripes.controller

Examples of net.sourceforge.stripes.controller.Intercepts


     * {@link ConfigurableComponent}, then its init() method will be called.
     */
    protected void addInterceptor(Map<LifecycleStage, Collection<Interceptor>> map,
            Interceptor interceptor) {
        Class<? extends Interceptor> type = interceptor.getClass();
        Intercepts intercepts = type.getAnnotation(Intercepts.class);
        if (intercepts == null) {
            log.error("An interceptor of type ", type.getName(), " was configured ",
                    "but was not marked with an @Intercepts annotation. As a ",
                    "result it is not possible to determine at which ",
                    "lifecycle stages the interceptor should be applied. This ",
                    "interceptor will be ignored.");
            return;
        }
        else {
            log.debug("Configuring interceptor '", type.getSimpleName(),
                    "', for lifecycle stages: ", intercepts.value());
        }

        // call init() if the interceptor implements ConfigurableComponent
        if (interceptor instanceof ConfigurableComponent) {
            try {
                ((ConfigurableComponent) interceptor).init(this);
            }
            catch (Exception e) {
                log.error("Error initializing interceptor of type " + type.getName(), e);
            }
        }

        for (LifecycleStage stage : intercepts.value()) {
            Collection<Interceptor> stack = map.get(stage);
            if (stack == null) {
                stack = new LinkedList<Interceptor>();
                map.put(stage, stack);
            }
View Full Code Here


     * {@link ConfigurableComponent}, then its init() method will be called.
     */
    protected void addInterceptor(Map<LifecycleStage, Collection<Interceptor>> map,
            Interceptor interceptor) {
        Class<? extends Interceptor> type = interceptor.getClass();
        Intercepts intercepts = type.getAnnotation(Intercepts.class);
        if (intercepts == null) {
            log.error("An interceptor of type ", type.getName(), " was configured ",
                    "but was not marked with an @Intercepts annotation. As a ",
                    "result it is not possible to determine at which ",
                    "lifecycle stages the interceptor should be applied. This ",
                    "interceptor will be ignored.");
            return;
        }
        else {
            log.debug("Configuring interceptor '", type.getSimpleName(),
                    "', for lifecycle stages: ", intercepts.value());
        }

        // call init() if the interceptor implements ConfigurableComponent
        if (interceptor instanceof ConfigurableComponent) {
            try {
                ((ConfigurableComponent) interceptor).init(this);
            }
            catch (Exception e) {
                log.error("Error initializing interceptor of type " + type.getName(), e);
            }
        }

        for (LifecycleStage stage : intercepts.value()) {
            Collection<Interceptor> stack = map.get(stage);
            if (stack == null) {
                stack = new LinkedList<Interceptor>();
                map.put(stage, stack);
            }
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.controller.Intercepts

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.