Hi,
Is there a way to get hold of a managed bean with session scope in a servlet filter? The code below throws an error due to the fact that the faces context is null.
FacesContext facesContext = FacesContext.getCurrentInstance();
System.out.println("facesContext: " + facesContext); // shows that facesContext is null
ApplicationFactory appFactory = ApplicationFactory)FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
Application app = appFactory.getApplication();
Object obj = app.createValueBinding("user").getValue(facesContext); //throws the error due to the null parameter
Object obj2 = app.createValueBinding("user"); //results in a valid ValueBinding
Here is the faces-config snippet for the managed bean:
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>biz.libereco.skemo.info.asl.beans.User</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
For the record, I am using JSF 1.0 Final.
Thank you,
Marcel