use of com.vaadin.quarkus.QuarkusVaadinServlet in project quarkus by vaadin.
the class VaadinServiceScopedContext method getContextualStorage.
@Override
protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExist) {
QuarkusVaadinServlet servlet = (QuarkusVaadinServlet) VaadinServlet.getCurrent();
String servletName;
if (servlet != null) {
servletName = servlet.getServletName();
} else {
servletName = QuarkusVaadinServlet.getCurrentServletName().get();
}
return BeanProvider.getContextualReference(Arc.container().beanManager(), ContextualStorageManager.class, false).getContextualStorage(servletName, createIfNotExist);
}
use of com.vaadin.quarkus.QuarkusVaadinServlet in project quarkus by vaadin.
the class VaadinQuarkusProcessor method mapVaadinServletPaths.
@BuildStep
void mapVaadinServletPaths(final BeanArchiveIndexBuildItem beanArchiveIndex, final BuildProducer<ServletBuildItem> servletProducer) {
final IndexView indexView = beanArchiveIndex.getIndex();
// Collect all VaadinServlet instances and remove QuarkusVaadinServlet
// and VaadinServlet from the list.
final Collection<ClassInfo> vaadinServlets = indexView.getAllKnownSubclasses(DotName.createSimple(VaadinServlet.class.getName())).stream().filter(servlet -> !servlet.name().toString().equals(QuarkusVaadinServlet.class.getName()) && !servlet.name().toString().equals(VaadinServlet.class.getName())).collect(Collectors.toList());
// If no VaadinServlet instances found register QuarkusVaadinServlet
if (vaadinServlets.isEmpty()) {
servletProducer.produce(ServletBuildItem.builder(QuarkusVaadinServlet.class.getName(), QuarkusVaadinServlet.class.getName()).addMapping("/*").setAsyncSupported(true).build());
} else {
registerUserServlets(servletProducer, vaadinServlets);
}
}
Aggregations