Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CssImport when using Component Exporter by Mikhail Shabarov, 7 months ago
Vaadin Spring Boot integration - custom servlet
Hi,
I need to get rid of the vaadin red error message when someone tries to interact with the application
after session timeout. According to book and few forum posts I would need to extends vaadin
servlet to do that. Since I use spring boot integration - how do I go about that ? I tried to simply
create a new servlet and return it as a bean in my application configuration class but that does not seem
to work properly. Any suggestions please ?
Thanks,
Adrian
Last updated on
@Bean(name="springBootServletRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
SpringVaadinServlet servlet = new SpringVaadinServlet() {
private static final long serialVersionUID = 1L;
class MySystemMessagesProvider implements SystemMessagesProvider {
private static final long serialVersionUID = 1L;
@Override
public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
CustomizedSystemMessages messages = new CustomizedSystemMessages();
messages.setCommunicationErrorCaption("Error - bla bla bla");
return messages;
}
}
@Override
public void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new SessionInitListener() {
private static final long serialVersionUID = 1L;
public void sessionInit(SessionInitEvent event) throws ServiceException {
event.getService().setSystemMessagesProvider(new MySystemMessagesProvider());
}
});
}
};
return new ServletRegistrationBean(servlet, "/UI/*");
}
That seems to be working properly !
Last updated on
You cannot reply to this thread.