In a Vaadin 8.0 project together with Spring boot, I am trying to use a Vaadin Add-on (WTPdfViewer, https://github.com/WhitesteinTechnologies/wt-pdf-viewer) for previewing PDF files.
The problem I have is that when trying to view the PDF file, the add-on tries to get the associated javascript resource from what I think is the wrong path. Thus it tries to get it from
http://localhost:8080/my/uipath/APP/PUBLISHED/pdf.worker.js
instead of what I think is the correct:
http://localhost:8080/vaadinServlet/APP/PUBLISHED/pdf.worker.js
The non-spring boot version of the project works correctly, so I assume it has something to do with the way Vaadin add-ons work in a Spring-boot project. Any ideas?
It seems that someone else had the same problem and posted the solution here: 404 for js files when using spring boot with vaadin
I am copying from that answer;
In short the solution is to create a controller that forwards the requests to the erroneous url to the correct one.
As for why this happens the linked answer provides a detailed explanation.