Package org.atmosphere.config.service

Examples of org.atmosphere.config.service.MeteorService


        synchronized (config.handlers()) {
            if (config.handlers().get(path) == null) {
                // MeteorService
                if (ReflectorServletProcessor.class.isAssignableFrom(w.atmosphereHandler.getClass())) {
                    Servlet s = ReflectorServletProcessor.class.cast(w.atmosphereHandler).getServlet();
                    MeteorService m = s.getClass().getAnnotation(MeteorService.class);
                    if (m != null) {
                        String targetPath = m.path();
                        if (targetPath.indexOf("{") != -1 && targetPath.indexOf("}") != -1) {
                            try {
                                boolean singleton = s.getClass().getAnnotation(Singleton.class) != null;
                                if (!singleton) {
                                    ReflectorServletProcessor r =
                                            config.framework().newClassInstance(ReflectorServletProcessor.class, ReflectorServletProcessor.class);
                                    r.setServlet(config.framework().newClassInstance(Servlet.class, s.getClass()));
                                    r.init(config);
                                    config.framework().addAtmosphereHandler(path, r,
                                            config.getBroadcasterFactory().lookup(m.broadcaster(), path, true), w.interceptors);
                                } else {
                                    config.framework().addAtmosphereHandler(path, w.atmosphereHandler,
                                            config.getBroadcasterFactory().lookup(m.broadcaster(), path, true), w.interceptors);
                                }
                                request.setAttribute(FrameworkConfig.NEW_MAPPING, "true");
                            } catch (Throwable e) {
                                logger.warn("Unable to create AtmosphereHandler", e);
                            }
View Full Code Here


        try {
            ReflectorServletProcessor r = framework.newClassInstance(ReflectorServletProcessor.class, ReflectorServletProcessor.class);
            r.setServletClassName(annotatedClass.getName());
            List<AtmosphereInterceptor> l = new LinkedList<AtmosphereInterceptor>();

            MeteorService m = annotatedClass.getAnnotation(MeteorService.class);
            framework.setBroadcasterCacheClassName(m.broadcasterCache().getName());

            String mapping = m.path();

            atmosphereConfig(m.atmosphereConfig(), framework);
            filters(m.broadcastFilters(), framework);

            AtmosphereInterceptor aa = listeners(m.listeners(), framework);
            if (aa != null) {
                l.add(aa);
            }

            AnnotationUtil.interceptors(framework, m.interceptors(), l);

            if (m.path().contains("{")) {
                framework.interceptors().add(framework.newClassInstance(AtmosphereInterceptor.class, MeteorServiceInterceptor.class));
            }
            framework.addAtmosphereHandler(mapping, r, broadcaster(framework, m.broadcaster(), m.path()), l);
        } catch (Throwable e) {
            logger.warn("", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.atmosphere.config.service.MeteorService

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.