extending VaadinCDIServlet

Hello,

I am attempting to create a responsive site using the @CDIUI annotation, the site works well except I need to add in the meta data for ios and other tablet/mobile devices. I found the tutorial on extending the Servlet which I have done, but I can not find how to add this to the app so it runs the MyServlet class instead of the VaadinCDIServlet class.

Here is the UI class:

[code]
@CDIUI( “” )
@Theme( “mytheme” )
@Widgetset( “AppWidgetset” )
public class Index extends UI
{
private static final long serialVersionUID = 7865189073630975648L;

@Inject
UserSession userSession;

@Inject
Instance<Login> login;

@Override
protected void init( VaadinRequest request )
{
    ...
}

void enter( String fragment )
{
    ...
}

}
[/code]Here is the Servlet class:

[code]
public class MyServlet extends VaadinCDIServlet
{
private static final long serialVersionUID = -493726102799793509L;

@Override
protected void servletInitialized() throws ServletException
{
    super.servletInitialized();
    getService().addSessionInitListener( new SessionInitListener() {
        private static final long serialVersionUID = -3494654194281279732L;

        @Override
        public void sessionInit( SessionInitEvent event )
        {
            event.getSession().addBootstrapListener(
                    new BootstrapListener() {
                        private static final long serialVersionUID = 1163081932146335044L;

                        @Override
                        public void modifyBootstrapFragment( BootstrapFragmentResponse response )
                        {}

                        @Override
                        public void modifyBootstrapPage( BootstrapPageResponse response )
                        {
                            Attributes attr = new Attributes();
                            attr.put( "name", "viewport" );
                            attr.put( "content",
                                      "width=device-width intial-scale=1, "
                                    + "maximum-scale=1 user-scalable=no" );
                            response.getDocument()
                                .head()
                                .appendChild(
                                new Element( Tag.valueOf( "meta" ), "",attr ) );
                        }
                    } );
        }
    } );
}

}
[/code]any guidance would be much appreciated

Many Thanks
Alex

Hi, try this:

@WebServlet(urlPatterns = "/*", name = "MyServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = Index.class, productionMode = false)
public class MyServlet extends VaadinCDIServlet
...

perfect thank you