Vaadin + 3rd party lib chat service

Hello,

how to add 3rd party live chat window into Vaadin app?

I would like to use Smartsupp.com. Usually Smartsupp integration consist in adding this part:

[code]

[/code]between and .

Is this possible in Vaadin?
I use Vaadin 7.5.6. and Vaadin Spring 1.0.0.beta1

Thanks.

I found solution.

Create a custom servlet that extend the SpringVaadinServlet:

import javax.servlet.ServletException;

import com.vaadin.server.BootstrapFragmentResponse;
import com.vaadin.server.BootstrapListener;
import com.vaadin.server.BootstrapPageResponse;
import com.vaadin.server.ServiceException;
import com.vaadin.server.SessionInitEvent;
import com.vaadin.server.SessionInitListener;
import com.vaadin.spring.server.SpringVaadinServlet;

@SuppressWarnings("serial")
public class MyServlet extends SpringVaadinServlet {

    @Override
    protected final void servletInitialized() throws ServletException {
        super.servletInitialized();
        
        getService().addSessionInitListener(new SessionInitListener() {

            @Override
            public void sessionInit(SessionInitEvent sessionInitEvent) throws ServiceException {            
                sessionInitEvent.getSession().addBootstrapListener(new BootstrapListener() {

                    @Override
                    public void modifyBootstrapPage(final BootstrapPageResponse response) {
                        response
                            .getDocument()
                            .head()
                            .append(
                                "<!-- Start of Smartsupp Live Chat script -->" + //
                                "<script type=\"text/javascript\">" + //
                                "var _smartsupp = _smartsupp || {};" + //
                                "_smartsupp.key = \"57a32598f68b294a6a4615f300bd4c85a946bfa0\";" + //
                                "window.smartsupp||(function(d) {" + //
                                "    var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=;" + //
                                "    s=d.getElementsByTagName('script')[0]
;c=d.createElement('script');" + //
                                "    c.type='text/javascript';c.charset='utf-8';c.async=true;" + //
                                "    c.src='//www.smartsuppchat.com/loader.js';s.parentNode.insertBefore(c,s);" + //
                                "})(document);" + //
                                "</script>" + //
                                "<!-- End of Smartsupp Live Chat script -->");
                    }

                    @Override
                    public void modifyBootstrapFragment(BootstrapFragmentResponse response) {
                    }
                });
            }
        });
    }

}

In child of UI change servlet:

@WebServlet(value = "/*", asyncSupported = true)
    public static class Servlet extends MyServlet {
        private static final long serialVersionUID = 1L;
    }