We are using Vaadin7 in a larger OSGI (karaf 4) application and have the VaadinServlet declared using blueprint:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint default-activation="eager" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<!-- Vaadin servlet serving static Vaadin resources -->
<service interface="javax.servlet.Servlet">
<service-properties>
<entry key="servlet-name" value="Vaadin Resources" />
<entry key="alias" value="/VAADIN-ui" />
<entry key="contextId" value="app-vaadin" />
</service-properties>
<bean class="com.vaadin.server.VaadinServlet" />
</service>
By default Vaadin runs in debug mode and has a setting of ProductionMode which needs to set to true. This can done as a context-param but the application does not use a web.xml file. I've tried to set it as property of the bean but it is not recognised.
You can extend VaadinServlet
and use VaadinServletConfiguration
annotation.
From docs:
Annotation for configuring subclasses of VaadinServlet. For a VaadinServlet class that has this annotation, the defined values are read during initialization and will be available using DeploymentConfiguration.getApplicationOrSystemProperty(String, String) as well as from specific methods in DeploymentConfiguration. Init params defined in web.xml or the @WebServlet annotation take precedence over values defined in this annotation.
You can use it like this:
@VaadinServletConfiguration(productionMode = false)
public class MyAppServlet extends VaadinServlet {
}