Vaadin + CDI with ContextDeployer: Extending VaadinServlet / Customizing Va


I am currently trying to customize the SystemMessages as described in
vaadin book 4.5.2
. However as we are using Vaadin CDI integration including ContextDeploayer it seems that it is neither possible to extend VaadinServlet nor Vaadin(Servlet)Service. As all the methods in ContextDeployer (especially com.vaadin.cdi.internal.ContextDeployer#registerServletToContext) are private I cannot even extend/customize my own ServletContextListener without copying & pasting the whole thing. This way it seems I cannot set my own SystemMessagesProvider before com.vaadin.server.BootstrapHandler#getApplicationParameters is called, which means I cannot customize messages like “sessionExpired” and “communicationError”.

Currently the only option I see would be to manually extend VaadinServlet and stop using the ContextDeployer completely. This seems like a pretty bad trade off considering all the stuff the ContextDeployer does (checking consistency in URIMappings etc.

I hope I am missing something obvious here, otherwise this would be a major drawback for us.

ticket #12390
for some comments on this.

Vaadin CDI 1.0.0.beta1 will have a custom VaadinCDIServletService which can be subclassed and a custom VaadinCDIServlet (currently only initializing the service). Using a custom servlet service by annotating it without subclassing the servlet could be supported in later versions.