RequestHandler not working on first loading

My development server is a tomcat 7, running on and my application is called FOO.
I’ve added a RequestHandler to render dynamic files depending on the URL, for instance /FOO/manifest should return a dynamic list of files instead of the UI.

I added my request handler in the attach() method of my UI class.

The first time(after a server restart) that I visit this page:, my request handler doesn’t have /manifest in getPathInfo()
Reloading the page (F5) makes it works.

What did I do wrong ?


Hey guys,

Problem fixed by adding a VaadinServlet and setting the request handler in a SessionInitListener which is set in service(HttpServletRequest request, HttpServletResponse response).

Again, I don’t know if it’s the good way of doing it.
You guys should write a note in the documentation about this issue.

Hi Serge,

Could you help me?

I try to create a request handler with vaadin 7 but it does not work me.

public class AdminUi extends UI
private final RequestHandler requestHandler = new RequestHandler()
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
return false;

 * Main UI
protected void init(VaadinRequest request)

	Resource resource = new ExternalResource("apple.png");
	Image image = new Image("image", resource);

public void detach() {
	// Clean up

But this code never calls the handleRequest method.

Could you help me?

Thank you.

I ran your code and it did call the handleRequest method and I got the output of the System.out in the console.

This is not true on my setup: vaadin 7.0.5 + tomcat 6
Here is the output for the first loading, and a refresh:

Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.

The request handler is only called for the refresh; because the session doesn’t exist on the first loading.
Which is really wrong, because some http client will not keep session from one request to another (for instance, a download program)

The “correct” way to add a request handler is to do it in the servlet:

public class MyServlet extends VaadinServlet {
	private final RequestHandler requestHandler = new RequestHandler()

	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		getService().addSessionInitListener(new SessionInitListener() {
			public void sessionInit(SessionInitEvent event)
					throws ServiceException {

Hi Everybody,

I have a similar problem, but using VaadinPortlet instead a VaadinServlet. As you know, this havent a service method implementation. Where can I set a new requestHandler in order to resolve this issue?
Are there any other solution?

Thanks in advance.

How do you register your custom MyServlet?