I need build some jsf urls in a @WebListener
.
I thought I could use a snippet of code like this one
final FacesContext currentInstance = FacesContext.getCurrentInstance();
final String actionURL = currentInstance.getApplication().getViewHandler()
.getActionURL(currentInstance, viewId);
because the javadoc of the .getCurrentInstance()
asserts it can be "[...] called during application initialization or shutdown" but it doesn't work because it returns null.
Do I miss somenthing? Any other way to build a url given the viewId?
Thanks