users@jersey.java.net

setting session attributes at resource startup

From: Arul Dhesiaseelan <arul_at_fluxcorp.com>
Date: Fri, 27 Jun 2008 15:06:17 -0600

Hi,

I am trying to set up a session attributes in the constructor of the
Resource. But, it looks like the session object is not injected yet when
I try to set attribute on the session.

  @Context
  private HttpServletRequest httpRequest;

  public MyResource() {
    httpRequest.getSession().setAttribute("securityenabled",
"true");//fails due to NPE
  }


Is there any other way to setup session attributes in the resource at
startup?

-Arul