pdfViewer : SpringBoot / vaadinServlet @Javascript

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


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.


I do have the same error. For me this was the solution.

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;

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() {