CDIUI and Custom Servlets

Hi, I have two different UI and I want just one of them to have a custom Servlet, but I can’t get it to work. This is my configuration for UI1:

@Title("Title 1")
@Theme("theme1")
@CDIUI("")
@Push(transport= Transport.LONG_POLLING)
@PreserveOnRefresh
public final class UI1 extends UI
{
   // Nothing more relevant. No servlet definition
}

And configuration for UI2:

[code]
@Title(“Title 2”)
@CDIUI(“UITWO”)
@Push(transport= Transport.LONG_POLLING)
@PreserveOnRefresh
public final class UI2 extends UI
{
@WebServlet(urlPatterns = “/UITWO”, asyncSupported = true, initParams = {
@WebInitParam( name = Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL, value = “30”),
@WebInitParam( name = Constants.SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS, value = “true”)
})
@VaadinServletConfiguration(productionMode = false, ui = UI2.class)
public static class Servlet extends VaadinCDIServlet
{
}


}
[/code]But his doesn’t work. When I go to http://localhost:8080/context/ I have an 404 and when I go to http://localhost:8080/context/UITWO I get a “Failed to load bootstrap”.
If I remove the Servlet definition in UI2, everything works fine and I can access both UIs on those addresses.

What is the correct way to do this?

Try with something like this:

[font=courier new]

@CDIUI(“/”)

public class UI1 extends UI {

@Override
protected void init(VaadinRequest vaadinRequest) { setContent(new Label("UI1")); }

@WebServlet([b]

urlPatterns = {“/", "/VAADIN/”}
[/b], asyncSupported = true)
@VaadinServletConfiguration(productionMode = false,
ui = UI1.class
)
public static class Servlet extends VaadinCDIServlet { }
}
[/font]
and:

[font=courier new]

@CDIUI(“ui2”)

public class UI2 extends UI {

@Override
protected void init(VaadinRequest vaadinRequest) { setContent(new Label("UI2")); }

@WebServlet([b]

urlPatterns = “/ui2/*”
[/b], asyncSupported = true)
@VaadinServletConfiguration(productionMode = false,
ui = UI2.class
)
public static class Servlet extends VaadinCDIServlet { }
}
[/font]