I have the following code and I'm searching for an other way to do this.
public static RequestContextData getRequestContextData() {
FacesContext fc = FacesContext.getCurrentInstance();
ExpressionFactory ef = fc.getApplication().getExpressionFactory();
MethodExpression me = ef.createMethodExpression( fc.getELContext(), "#{requestContextData.getRequestContextData}", String.class, new Class[0]);
Object o = me.invoke(fc.getELContext(), null);
RequestContextData request = (RequestContextData) o;
return request;
}
I found out that it causes problems after upgrading to tomcat 8. The ELContext is already resolved and with this code afterwards it wouldn't be resolved anymore. I already tried it with a managed property but this won't work.
Addition 1: The stack looks like the following:
- xxx.getRequestContextData()
- some other methods
- BeanELResolver.getValue(ELContext, Object, Object)
The ELContext is in BeanELResolver and xxx the same one. That leads to the malfunction that the xxx overwrites the resolved property with false in the BeanELResolver which then returns an PropertyNotFoundException.