You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple link for downloading a dynamically generated file does not work in the Spring skeleton starter, but the same code works as expected in the non-spring skeleton starter.
StreamResource resource = new StreamResource("filename", () -> new ByteArrayInputStream("Hello world".getBytes()));
Anchor download = new Anchor("", "Download configuration");
download.getElement().setAttribute("href", resource);
In the Spring case, the target URL seems to trigger the RouteNotFoundError handler instead of serving the StreamResource contents.
The text was updated successfully, but these errors were encountered:
This seems to be caused by the way the servlet is mapped when using Spring.
Requests reaching StreamRequestHandler have the VAADIN/ part of the requested URL as getServletPath() whereas the logic expects the full URL to be in getPathInfo(). This is further complicated by the fact that getServletPath() is only available in VaadinServletRequest, but not in the generic VaadinRequest interface.
One idea for fixing this might be to introduce an additional method into VaadinRequest that gets the request URL relative to the context root, i.e. servletPath+ pathInfo. Logic that is always assumed to be mapped to the context root, e.g. anything related to the VAADIN/ namespace would then use this new method instead of the currently used getPathInfo().
A simple link for downloading a dynamically generated file does not work in the Spring skeleton starter, but the same code works as expected in the non-spring skeleton starter.
In the Spring case, the target URL seems to trigger the
RouteNotFoundError
handler instead of serving theStreamResource
contents.The text was updated successfully, but these errors were encountered: