pdfViewer : SpringBoot / vaadinServlet @Javascript

Hello,
I am using the pdfViewer addon : https://vaadin.com/directory/component/pdfviewer

This component loads different JS modules : https://github.com/radekpakula/pdf-viewr-addon/blob/vaadin8/pdfviewer-addon/src/main/java/pl/pdfviewer/PdfViewer.java

@JavaScript({"pdf.worker.js","pdf.js","dragscroll.js","pdf.viewer.js","print.js"})

The demo project is a SpringBoot application. The main JS component is loaded from this URL : http://host/**vaadinServlet**/APP/PUBLISHED/pdf.js

However, “pdf.js” tries to load the other modules from another URL : http://host/APP/PUBLISHED/pdf.worker.js, without vaadinServlet

I tried different @JavaScript configuration (“pdf.worker.js”) (“app://pdf.worker.js”) but everything gets published under vaadinServlet

Is there a simple workaround to make the addons loads the required dependencies from http://host/APP/PUBLISHED/ ?

Thanks for your help.

Elyes

I do have the same error. For me this was the solution.
https://stackoverflow.com/questions/45288885/404-for-js-files-when-using-spring-boot-with-vaadin

Sorry, I forgot to reply.
Thank you very much, it solved the issue !

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PdfJsRedirectController {
    private static final String WORKER_JS_INCORRECT_PATH = "/APP/PUBLISHED/pdf.worker.js";
    private static final String WORKER_JS_CORRECT_FORWARD_PATH = "forward:/vaadinServlet/APP/PUBLISHED/pdf.worker.js";

    @RequestMapping(value = WORKER_JS_INCORRECT_PATH)
    public String forwardWorkerJsRequestToVaadin() {
        return WORKER_JS_CORRECT_FORWARD_PATH;
    }
}