Hi,

I'd like to get access to the current session from inside my resteasy handler 
methods. But when I inject the request and call getSession() on it, I get a 
NullPointerException. 
My original goal was to get access to SessionState objects from tapestry by 
calling the ApplicationStateManager.get() method with our SessionState object. 
But this fails for the same reason.
Why is the session object not accessible from the injected Request object in a 
ResteasyHandler?

The code below will throw an exception on the line request.getSession(false).

@Path("/resttest")
public class TestResource
{

        @Inject
        private Request request;

        @Inject
        private ApplicationStateManager asm;

        @InjectResource
        private Logger log;


        @GET
        @Produces("text/xml")
        public List<TestEntity> getEntityList()
        {

                log.warn("REST Request in request " + request);
                log.warn("REST Request in session2 " + 
request.getSession(false));


M.


Reply via email to