Running both vaadin application and REST services with mapping


My vaadin app works default (1 below). However my REST services (2 below) does not work with the same configuration and vice/versa at same time.

  1. vaadin http://localhost:8080/facmulta/

public class MyVaadinUI extends UI

@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "ch.oneict.facmulta.vaadin.AppWidgetSet")
public static class Servlet extends TouchKitServlet {

protected void init(VaadinRequest request) {   

  1. REST http://localhost:8080/facmulta/service/getAllPersonenInXML

Calling the REST http ends up starting the vaadin app not my XML/JSON REST services.
However changing the following my REST works after a restart:

@WebServlet(value = “/", asyncSupported = true)
@WebServlet(value = "/ui/
”, asyncSupported = true)

Now my REST deliver XML/JSON with the links (my vaadin does not work anymore):


How can I make this work together?

My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?> resteasy org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher Resteasy /rest/* resteasy.scan true resteasy.servlet.mapping.prefix / 30


If you move the default /* mapping for a Vaadin application you also need to make sure that Vaadin can find the /VAADIN/* url from where it loads all the static resources.

Have a look at
section “Mapping sub-paths”.

You should have

@WebServlet(value = "/*", value = "/VAADIN/*, asyncSupported = true) and make sure nothing else intercepts those requests.

I managed this way:

@WebServlet(urlPatterns = {"/app/*", "/VAADIN/*"}, initParams = {
        @WebInitParam(name = "productionMode", value = "true")})

That worked. Thanks! There is a spelling error though… Corrected:
@WebServlet(urlPatterns = {“/app/", "/VAADIN/”}, asyncSupported = true)

Thanks ! See also other reply.


I have the same secnario, where i have downloaded vaadin hello world application, for that i have added a Restful service, however, i would not be able to configure the remaining part, how to connect this rest full service to the vaadin application UI. i do not hve web.xml in hellow world app, could you please attache a working sample, with this restfull webservice implementation with vaadin application. i have tried a lot but no luck.

public class HelloWorldUI extends UI {
private int clickCounter = 0;
private Label clickCounterLabel;

@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = HelloWorldUI.class)
public static class Servlet extends VaadinServlet {
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();

    layout.addComponent(new Label("Hello World!"));

[/code]rest full web service with jersy

import; import; import; import; @Path("/hello") public class HelloWorldService { @GET @Path("/{param}") public Response getMsg(@PathParam("param") String msg) { String output = "Jersey say : " + msg; return Response.status(200).entity(output).build(); } } Here i would like to connect these two, vaadin UI and web service, that would give the out put as follows:

http://localhost:8080/myui - should redirect to the hello world vaadin app ui
http://localhost:8080/rest/hello/ - should call my webservice.

Thanks in Advance!