custom meta tags in vaadin 7

Any idea how we can set our own custom meta tags in vaadin 7? I believe in vaadin 6 we could override the writeAjaxPageHtmlHeader is that still the preferred method?

Thanks a bunch.

Support for modifying the bootstrap page is currently being implemented. A crude implementation was pushed yesterday in
commit 2b0cb55ef291f
. The API will be slightly restructured in the upcoming days, but the core functionality is at least in place now.

Is there a final implementation (and documentation) for this? I need to be doing something similar and would like to do it the “right” way.


There is
tutorial on modifying the bootstrap page. Maybe not doing exactly what you want, but they should give a starting point, at least.

Any news on the status of this? Is it ready?

Many thanks!

It is included already in 7.0.0 - see the tutorials I linked to.

Ah great, thanks for that, for anyone looking in the future here is an example of my code:

package com...;

import javax.servlet.ServletException;

import com.vaadin.server.BootstrapFragmentResponse;
import com.vaadin.server.BootstrapListener;
import com.vaadin.server.BootstrapPageResponse;
import com.vaadin.server.SessionInitEvent;
import com.vaadin.server.SessionInitListener;
import com.vaadin.server.VaadinServlet;

public class Servlet extends VaadinServlet {

    protected void servletInitialized() throws ServletException {
        getService().addSessionInitListener(new SessionInitListener() {

            public void sessionInit(SessionInitEvent event) {
                event.getSession().addBootstrapListener( new BootstrapListener() {

					public void modifyBootstrapFragment(
							BootstrapFragmentResponse response) {
						// TODO Auto-generated method stub

					public void modifyBootstrapPage(BootstrapPageResponse response) {
						response.getDocument().head().prependElement("meta").attr("name", "viewport").attr("content", "width=device-width");