I am trying to load a local file located inside src/main/resources/META-INF/resources/resources/
directory. The application is a joinfaces based app that includes myfaces, omnifaces and rewrite. Before migrating my project (classic JSF WAR) to joinfaces, I was doing it by providing a real path to the file like this:
FacesContext.getCurrentInstance().getExternalContext().getRealPath("/resources");
Since my project uses omnifaces the getExternalContext()
returns org.omnifaces.context.OmniExternalContext
, while the whole expression returns null.
If I just run:
FacesContext.getCurrentInstance().getExternalContext().getRealPath("/")
it returns a path to a temporal directory created by the embedded tomcat (i.e.: C:\Users\User\AppData\Local\Temp\tomcat-docbase.4856998207101083356.8443\
) that is empty.
In this case I do not really require an absolute path to a static resource contained inside my application, it was just one way to do it, but still I can find no method to achieve this and the joinfaces documentation is minimal. Any ideas?