Why not trying to load the resource from the point of view of the class :
this.getClass().getResourceAsStream(<the resources you seek>)
This is likely to be more portable.
Hope this help.
If you can get a hold of the ServletContext you can get it by calling:
1. to the first question...
The phone api I am using takes a base file path and not a url :( While in the future, I would like to change that, right now, I need to use KISS and make money before we go out of business :)
Actually, I knew this already, and I thought one could get this from facesContext but it seems facesContext is not injected if there is no session maybe? I keep getting null for my facescontext and I am taking a wild wild guess that it is because I use the @Startup so the bean starts up to early??? anyone know? I would really like to get that servletCtx path.
FacesContext facesContext = FacesContext.getCurrentInstance();
If so you can do this:
ExternalContext extCtx = FacesContext.getCurrentInstance().getExternalContext(); ServletContext serCtx = (ServletContext) extCtx.getContext();
That didn't work. getCurrentInstance() returned null!!! Is this a bug in seam.
NullPointerException occurred on the second line here.....
FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext extCtx = ctx.getExternalContext(); ServletContext serCtx = (ServletContext) extCtx.getContext();
Did you got a solution? To get context path inside a @StartUp - @Create method?
no, I think I just waited for the very first web request which gave me all the info I needed in it which kinda of was a hack solution.