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);
}