Search in sources :

Example 1 with QuarkusVaadinServlet

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);
}
Also used : QuarkusVaadinServlet(com.vaadin.quarkus.QuarkusVaadinServlet)

Example 2 with QuarkusVaadinServlet

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);
    }
}
Also used : RouteContextWrapper(com.vaadin.quarkus.context.RouteContextWrapper) UIContextWrapper(com.vaadin.quarkus.context.UIContextWrapper) DotName(org.jboss.jandex.DotName) RouteScoped(com.vaadin.quarkus.annotation.RouteScoped) ClassInfo(org.jboss.jandex.ClassInfo) CombinedIndexBuildItem(io.quarkus.deployment.builditem.CombinedIndexBuildItem) VaadinServiceScoped(com.vaadin.quarkus.annotation.VaadinServiceScoped) VaadinSessionScopedContext(com.vaadin.quarkus.context.VaadinSessionScopedContext) BuildProducer(io.quarkus.deployment.annotations.BuildProducer) Route(com.vaadin.flow.router.Route) ServletBuildItem(io.quarkus.undertow.deployment.ServletBuildItem) NormalUIScoped(com.vaadin.quarkus.annotation.NormalUIScoped) BuildStep(io.quarkus.deployment.annotations.BuildStep) AdditionalBeanBuildItem(io.quarkus.arc.deployment.AdditionalBeanBuildItem) FeatureBuildItem(io.quarkus.deployment.builditem.FeatureBuildItem) HasErrorParameter(com.vaadin.flow.router.HasErrorParameter) BeanArchiveIndexBuildItem(io.quarkus.arc.deployment.BeanArchiveIndexBuildItem) UIScoped(com.vaadin.quarkus.annotation.UIScoped) IndexView(org.jboss.jandex.IndexView) AnnotationValue(org.jboss.jandex.AnnotationValue) VaadinServiceScopedContext(com.vaadin.quarkus.context.VaadinServiceScopedContext) ContextRegistrationPhaseBuildItem(io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem) UIScopedContext(com.vaadin.quarkus.context.UIScopedContext) Collection(java.util.Collection) ContextConfiguratorBuildItem(io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem) VaadinServlet(com.vaadin.flow.server.VaadinServlet) CustomScopeBuildItem(io.quarkus.arc.deployment.CustomScopeBuildItem) RouteScopedContext(com.vaadin.quarkus.context.RouteScopedContext) Collectors(java.util.stream.Collectors) WebServlet(javax.servlet.annotation.WebServlet) Objects(java.util.Objects) Stream(java.util.stream.Stream) AnnotationInstance(org.jboss.jandex.AnnotationInstance) BeanDefiningAnnotationBuildItem(io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem) NormalRouteScoped(com.vaadin.quarkus.annotation.NormalRouteScoped) Optional(java.util.Optional) VaadinSessionScoped(com.vaadin.quarkus.annotation.VaadinSessionScoped) QuarkusVaadinServlet(com.vaadin.quarkus.QuarkusVaadinServlet) QuarkusVaadinServlet(com.vaadin.quarkus.QuarkusVaadinServlet) IndexView(org.jboss.jandex.IndexView) VaadinServlet(com.vaadin.flow.server.VaadinServlet) QuarkusVaadinServlet(com.vaadin.quarkus.QuarkusVaadinServlet) ClassInfo(org.jboss.jandex.ClassInfo) BuildStep(io.quarkus.deployment.annotations.BuildStep)

Aggregations

QuarkusVaadinServlet (com.vaadin.quarkus.QuarkusVaadinServlet)2 HasErrorParameter (com.vaadin.flow.router.HasErrorParameter)1 Route (com.vaadin.flow.router.Route)1 VaadinServlet (com.vaadin.flow.server.VaadinServlet)1 NormalRouteScoped (com.vaadin.quarkus.annotation.NormalRouteScoped)1 NormalUIScoped (com.vaadin.quarkus.annotation.NormalUIScoped)1 RouteScoped (com.vaadin.quarkus.annotation.RouteScoped)1 UIScoped (com.vaadin.quarkus.annotation.UIScoped)1 VaadinServiceScoped (com.vaadin.quarkus.annotation.VaadinServiceScoped)1 VaadinSessionScoped (com.vaadin.quarkus.annotation.VaadinSessionScoped)1 RouteContextWrapper (com.vaadin.quarkus.context.RouteContextWrapper)1 RouteScopedContext (com.vaadin.quarkus.context.RouteScopedContext)1 UIContextWrapper (com.vaadin.quarkus.context.UIContextWrapper)1 UIScopedContext (com.vaadin.quarkus.context.UIScopedContext)1 VaadinServiceScopedContext (com.vaadin.quarkus.context.VaadinServiceScopedContext)1 VaadinSessionScopedContext (com.vaadin.quarkus.context.VaadinSessionScopedContext)1 AdditionalBeanBuildItem (io.quarkus.arc.deployment.AdditionalBeanBuildItem)1 BeanArchiveIndexBuildItem (io.quarkus.arc.deployment.BeanArchiveIndexBuildItem)1 BeanDefiningAnnotationBuildItem (io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem)1 ContextRegistrationPhaseBuildItem (io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem)1