2 Replies Latest reply on Oct 3, 2007 1:36 PM by matt.drees

    Accessing HttpSession in Jboss Seam

    ojio_bis

      We are in the process of migrating a complex application written in Coldfusion
      to J2EE.
      My company has a vision of moving the apps to Jboss + RHL platform.
      We choose Jboss seam as our web framework.

      As the first step we want to first start with doing the new functionalities (Completely new enhancements) in Jboss seam and integrate this with the existing coldfusion app.

      Coldfusion MX runs in Jboss and java apps can happily share session across. So with conventional jsp model + frames I can work this out by floating the session across coldfusion and jsp.
      We have done a POC and this works.

      I think idea behind seam was to move out of explicit session handling.

      But still is there anyway I can access the HttpSession to float the state across coldfusion and Jboss Seam application.

      Thanks a lot

        • 1. Re: Accessing HttpSession in Jboss Seam

          I don't think this is really a Seam issue but rather JSF

          FacesContext context = FacesContext.getCurrentInstance();
           HttpSession session = (HttpSession) context.getExternalContext().getSession(false);


          Of course you can use a Seam API to get the FacesContext

          org.jboss.seam.core.FacesContext

          • 2. Re: Accessing HttpSession in Jboss Seam
            matt.drees

            You can even inject (non-Seam) session values into your Seam components:

            @In("my_session_object_key") MySessionObjectType mySessionObject;
            


            The cool thing about this is if you later decide to move your object to a different scope (eg conversation), you don't have to change this code at all!