vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
616 stars 169 forks source link

OSGi: Register a VaadinServlet using Http Whiteboard specification #4796

Open denis-anisimov opened 5 years ago

denis-anisimov commented 5 years ago

At the moment developer should care himself about VaadinServlet registration for his OSGi bundle.

There are several ways to do it:

The first way has been used in original OSGi tests for jetty-osgi-boot as a web server container within Apache Felix. See https://github.com/vaadin/flow/blob/7314427ae8c40104e627f6a2a4e41cb4ff121f74/flow-tests/test-root-context/bnd.bnd#L8

But once I changed the web container from jetty-osgi-boot to felix-jetty this way doesn't work anymore: the container recognizes a bundle as a WAB it says that the context root is occupied ( by the way felix-jetty doesn't allow to use "/" as a context root for a custom WAB) but web servlets are not instantiated and nothing works. I don't know whether this is something specific for felix-jetty or may be I missed something additionally or additional config is required. It's possible to register a servlet programmatically though either via HttpService or via Http Whiteboard specification.

This is done as a modern way of OSGi tests in Flow.

But

denis-anisimov commented 5 years ago

See also #4797

denis-anisimov commented 5 years ago

We need servlet auto-registration for https://github.com/vaadin/flow/issues/5125. This should be a custom OSGi specific servlet rather than plain VaadinServlet.

We should not auto-register the servlet in case the application contains a custom servlet.