1 Reply Latest reply on Feb 16, 2004 2:01 AM by eric dunn

    Session Management Accross another Context

    eric dunn Newbie

      Hi,
      I have two webapps, A and B under their respective context roots.

      'A' creates a session and puts some values in there.

      'A' has a link on web page that explicitly calls out a URL in 'B's context like /B/some_servlet .

      Whenever I click on that link, the some_servlet does a check for that same session, and gets a null back for a request.getSession(false).

      I had the understanding that a session is linked to the client itself and it should not matter where he is going in the servlet container, his session object would stay accessable for the lifetime of the session.


      - Does the session object propogate across two different contexts?

      If you are curious, I am doing this because I want one app to easilly integrate with another app by just moving between servlet contexts rather than copying over the actual JSPs and servlets to the original context.

      A colleague has said in Tomcat he can achieve this using the crosscontext=true in the sever.xml file.

      I am using Jboss 3.2.2. It has a built in Tomcat contatiner (a-la server.xml).

      My JBoss transparently deploys things under its respective context by way of my application.xml specifying the context. I have no where to put in a server.xml with anything similar to the following:



      Is there a comprable tag I can put in application.xml, or web.xml, or jboss-web.xml? Or perhaps a global setting I can put in jboss-service.xml for it to be shared accross all contexts?

      Thanks,

      user : J2EE_IS_GREAT_1980!

        • 1. Re: Session Management Accross another Context
          eric dunn Newbie

          Oh and by the way...The servlet spec says what I am asking is actually not legal...

          "
          SRV.7.3 Session Scope
          HttpSession objects must be scoped at the application (or servlet context) level.
          The underlying mechanism, such as the cookie used to establish the session, can be
          the same for different contexts, but the object referenced, including the attributes in
          that object, must never be shared between contexts by the container.
          To illustrate this requirement with an example: if a servlet uses the Request-
          Dispatcher to call a servlet in another web application, any sessions created for
          and visible to the callee servlet must be different from those visible to the calling
          servlet.
          "

          I assume JBoss/Tomcat's mod will help me get around this limitation.