in my application I have set the heartbeat interval in the web.xml file.
Now with every heartbeat been send from the client, i must send a heartbeat to another service.
I search all documentation and of course I used google, but nothing popped up so far.
If anybody knows which method to overwrite to achieve this
I’m not aware of any ‘heartbeatevent’ or anything like that. But one option would be to add your own request handler for example in your servlet init using the VaadinSession.getCurrent().addRequestHandler method.
The implementation of your custom request handler would be pretty much like com.vaadin.server.communication.HeartbeatHandler, but you should not write a response and you should always return false in order to invoke the actual HeartbeatHandler too. From this custom request handler you could then call any services etc. you want.
thanks for replying to my question. I understand that i have to add my own listener.
But in my Vaadinservlet instance the Vaadinsession.getCurrent() always returns null …
Adding the Handler in my UI does not seems to have any effect at all
so … no way to add a handler or to trace every heartbeat request in the UI
In VaadinServlet.init() there can be no sessions, as the servlet is only initializing. But you can add a session init listener in which you can add the custom heartbeat listener:
[code]
class MyServlet extends VaadinServlet implements SessionInitListener { @Override
public void init() {
getService().addSessionInitListener(this);
}
}
[/code]Alternatively, you can add a global RequestHandler by overriding VaadinServlet.createVaadinServletService() to return a custom VaadinServletService subclass that overrides VaadinService.createRequestHandlers().