I'm am making some experiments
and I've written this cdi called from within a jsf page
but I get a nullpointer exception is that a valid setup or is not legit
to get HttpServletRequest from within a request scoped cdi?
Thank You
Details follow:
Apache Tomcat (TomEE)/7.0.68 (1.7.4) (plumee)
CDI code extract
@Named
@RequestScoped
public class UserProfileManager implements Serializable {
@Context
private ServletContext context;
@Context
private HttpServletRequest request;
@Context
private HttpServletResponse response;
public LoggedUser getUser() {
Enumeration<String> names= request.getAttributeNames(); //null
pointer exception here -> request is not null
/* other not relevant code */
}
}