protected void mapAnnotatedService(boolean reMap, String path, AtmosphereRequest request, AtmosphereFramework.AtmosphereHandlerWrapper w) {
synchronized (config.handlers()) {
if (config.handlers().get(path) == null) {
// ManagedService
if (AnnotatedProxy.class.isAssignableFrom(w.atmosphereHandler.getClass())) {
AnnotatedProxy ap = AnnotatedProxy.class.cast(w.atmosphereHandler);
ManagedAnnotation a = managed(ap, request.resource());
if (a != null) {
String targetPath = a.path();
if (targetPath.indexOf("{") != -1 && targetPath.indexOf("}") != -1) {
try {
boolean singleton = ap.target().getClass().getAnnotation(Singleton.class) != null;
if (!singleton) {
AnnotatedProxy h = proxyHandler();
final Object o = config.framework().newClassInstance(Object.class, ap.target().getClass());
h.configure(config, o);
if (h.pathParams()) {
prepareForPathInjection(path, targetPath, o);
}
config.framework().addAtmosphereHandler(path, h,
config.getBroadcasterFactory().lookup(a.broadcaster(), path, true), w.interceptors);