Hello,
i have a simple Servlet:
[code]
@WebServlet(urlPatterns = { “/start” })
public class FrontController extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/myapp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
[/code]which forwards to a simple Vaadin application: myapp
[code]
@Theme(“myapp”)
public class MyappUI extends UI {
private static final long serialVersionUID = 1L;
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
final TextField name = new TextField("Your Name");
final Button button = new Button("Click Me", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
layout.addComponent(new Label(name.getValue()));
}
});
layout.addComponents(name, button);
setContent(layout);
}
@WebServlet(urlPatterns = {"/myapp/*", "/VAADIN/*"}, name = "MyappUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyappUI.class, productionMode = false)
public static class MyappUIServlet extends VaadinServlet {
private static final long serialVersionUID = 1L;
}
}
[/code]If i call the FrontController servlet from the browser using: http://localhost:8080/myapp/start, it forwards nicely to the Vaadin app. But the next request to the server (clicking the button) displays a (never ending) message: Server connection lost, trying to reconnect.
Of course it is possible to use ‘redirect’ instead of ‘forward’, but this is not wanted. I think the situation arises very often when migrating old web apps partly to Vaadin, but i haven’t found a solution within the documents or by googling.
Any advice is very appreciated, thank you.