Integrated web application all requests go to Vaadin

While integrating Vaadin into a pre-existing web application I started routing all web requests to the Vaadin application instead of them being limited to the request paths defined in the servlet-mappings.

Using Vaadin 7.1.10 + Tomcat 7

This must be a simple configuration issue but I have not discovered it yet.

I have
2 projects:

  1. Simple Vaadin project generated from maven

    vaadin-archetype-application

    . This creates the common ‘Click It’ Vaadin application. I took the relevant artifacts generated from this project and bundled them into a .jar.
  2. Simple web application generated from

    maven-archetype-webapp

    .

I tested both web applications independently. Both work as expected. In the web application I added a simple subclass to the VaadinServlet called
com.jgk.vaadin.JgkVaadinServlet
.


Integration - then:

  1. I added the interesting Vaadin dependencies to the Simple web application. I also added a dependency to the generated bundle .jar mentioned above.
  2. I modified the web.xml (2.4 web app) to include the following:
<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 

    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID">




  <display-name>jgkmyapp</display-name>

    <servlet>

        <servlet-name>VaadinServlet</servlet-name>

        <servlet-class>

            com.jgk.vaadin.JgkVaadinServlet

        </servlet-class>

        <init-param>

            <param-name>UI</param-name>

            <param-value>com.gs.MyVaadinUI</param-value>

        </init-param>

    </servlet>

    <welcome-file-list>

        <welcome-file>index.html</welcome-file>

        <welcome-file>index.htm</welcome-file>

        <welcome-file>index.jsp</welcome-file>

        <welcome-file>default.html</welcome-file>

        <welcome-file>default.htm</welcome-file>

        <welcome-file>default.jsp</welcome-file>

    </welcome-file-list>

<servlet-mapping>

        <servlet-name>VaadinServlet</servlet-name>

        <url-pattern>/jedi/*</url-pattern>

</servlet-mapping>




    <servlet-mapping>

        <servlet-name>VaadinServlet</servlet-name>

        <url-pattern>/VAADIN/*</url-pattern>

    </servlet-mapping>

      

</web-app>
  1. I started the now-Vaadin-integrated web application. But no matter what URL I provide, the Vaadin application is presented in the web-browser.

For example:

Any suggestions?

Thanks in advance.

I think I see the problem, the UI (MyVaadinUI) generated by the archetype includes a Servlet 3.0 annotation (WebServlet) that is reserving the path (/*). This gets bundled into the bundle I mentioned in the original post. When Tomcat 7 bootstraps it must respect this annotation over the servlet mappings.

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "com.gs.AppWidgetSet")

For those interested in overriding the settings, have a look at
HERE
.