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:
- 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. - 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:
- I added the interesting Vaadin dependencies to the Simple web application. I also added a dependency to the generated bundle .jar mentioned above.
- 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>
- 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:
- http://localhost:8080/myproject/index.jsp ===> goes to Vaadin Application
- http://localhost:8080/myproject/bogus ===> goes to Vaadin Application
Any suggestions?
Thanks in advance.