Push problem when recovering from server restart

Our Vaadin app is using Atmosphere push with websockets and we’re trying to recover from server restarts. If the server restarts while a user is logged in there’s not much that can be done. However, when the server retarts and the user uses the browser instance (does not close and reopen) they get directed to the wrong URL.


But get this:

Some debugging with UrlRewriteFilter shows the new URL is http://localhost:8080/site/auth/PUSH/PUSH/ which is one too many PUSH directories.

Is there a way I can clean this up when the server restarts? Maybe through JavaScript? Using UrlRewriteFilter rules just creates an endless loop.

My company ended up going through vaadin Pro services. There’s an aknowledged issue here but they gave us a workaround.

Create a filter in your web.xml


Then create the class you reference in the web.xml and extend javax.servlet.Filter. Override the doFilter(…) method. Here’s what ours looks like.

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
String transport = request.getParameter(“X-Atmosphere-Transport”);

if (transport != null && transport.equals("close"))
    String contextPath = ((HttpServletRequest) request).getContextPath();
    ((HttpServletResponse) response).sendRedirect(contextPath);
    chain.doFilter(request, response);