Loading lumo.css with @StyleSheet or any direct url does not work out of the box for me.
I have a j2ee application, where the main war (ptsmc) has two distinct paths:
/ptsmc/app - All vaadin stuff. Requires login
/ptsmc/ - public stuff
In web.xml, “/ptsmc/app” is routed to VaadinServlet
Part of the problem might be that I pack vaadin into a separate jar, ptsmc-widgetset, so that it can be shared with several other entrypoints that we have. This is deployed to ear/lib
In this setup, what is the right url, if any, to load lumo.css?
@StyleSheet(Lumo.STYLESHEET) → lumo/lumo.css → /ptsmc/lumo/lumo.css → Doesn’t work
/ptsmc/app/lumo/lumo.css → Doesn’t work
/ptsmc/app/VAADIN/lumo/lumo.css → Doesn’t work
I flagged this in during the beta program as well, but I never heard anything back.
I’ve worked around this by creating a simple servlet on “lumo” (ie “/ptsmc/lumo” ) that does:
This looks strange. The CSS should be served directly from the container, since the resource is in META-INF/resources in the lumo JAR file.
Unless there’s something else (e.g. another filter or servlet) that intercepts the request and prevents the container from resolving the resource.
Or maybe some servlet container configuration.
I see I was a bit unclear when I said I get 404.
I do get 404, but I also get a response: “Request was not handled by any registered handler.”
Maybe Vaadin is accessing stuff with the wrong classloader?
If it is using the classloader of VaadinServlet, it will probably not see it.
The structure of the application is:
ptsmc.ear :
lib\vaadin-xxx.jar
lib\ptsmc-core.jar
ptsmc-web.war
ptsmc-xxx.war
In this case it is “ptsmc-web” I’m accessing, but I have several entrypoints, so I’ve put most shared things in ear\lib, including vaadin.
ptsmc-web.war should be able to access everything in itself and everything in lib.
The things in lib can only see themselves, if they use the this.getClassLoader
My workaround servlet, mentioned earlier, does: Thread.currentThread().getContextClassLoader()
and then I’m able to access everything in ptsmc-web + lib
You are right. If I put vaadin-lumo-theme.jar directly into ptsmc-web:WEB-INF\lib, then I’m able to access it with /ptsmc/lumo/lumo.css
In theory this should’ve worked the same with vaadin-lumo-theme.jar in ear\lib, but obviously not.
Everything in ear\lib is available on the classpath, but it seems META-INF/resources is not automatically exposed.