
com.github.aesteve.vertx.nubes.reflections.SocketFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nubes Show documentation
Show all versions of nubes Show documentation
Provides an annotation layer on top of vertx-web.
The newest version!
package com.github.aesteve.vertx.nubes.reflections;
import com.github.aesteve.vertx.nubes.Config;
import com.github.aesteve.vertx.nubes.annotations.sockjs.SockJS;
import com.github.aesteve.vertx.nubes.reflections.visitors.SockJSVisitor;
import io.vertx.ext.web.Router;
import org.reflections.Reflections;
import java.util.Set;
public class SocketFactory implements HandlerFactory {
private final Router router;
private final Config config;
public SocketFactory(Router router, Config config) {
this.router = router;
this.config = config;
}
@Override
public void createHandlers() {
config.forEachControllerPackage(controllerPackage -> {
Reflections reflections = new Reflections(controllerPackage);
Set> controllers = reflections.getTypesAnnotatedWith(SockJS.class);
controllers.forEach(this::createSocketHandlers);
});
}
private void createSocketHandlers(Class controller) {
SockJSVisitor visitor = new SockJSVisitor<>(controller, config, router);
visitor.visit();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy