tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirys <ki...@neoteroi.org>
Subject Is this legit? @RequestScoped vs HttpServletRequest
Date Sun, 08 May 2016 11:36:27 GMT
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 */

     }


}

Mime
View raw message