giulianob83
(Giuliano Buompastore)
1
Hi, i’ve notice that when i open my vaadin app from external page (ex:http://www.test.com) the referer url is the same of app (http://localhost:8080)
String referer=VaadinRequest.getCurrent().getHeader("referer");
log.debug(referer)
console print -> http://localhost:8080
What can i do to get the correct referer? (http://www.test.com) ?
thanks a lot
giulianob83
(Giuliano Buompastore)
2
I’ve found this solution if someone is interested
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = true, ui = MyUi.class)
public static class Servlet extends VaadinServlet {
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new SessionInitListener() {
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
String referer = event.getRequest().getHeader("referer");
event.getRequest().getWrappedSession().setAttribute("referer", referer);
// event.getRequest().setAttribute("referer",referer);
}
});
}
}