4 Replies Latest reply on Jul 31, 2007 12:40 PM by ewfolf

    Get *Context from Servlet

    ewfolf Newbie

      Hi, I'm trying to access a Seam Context from a Servlet.
      Unfortunately I get always NullPointerExceptions.

      I tempt things like that:

      Contexts.getCoversationContext().set("foo", new String("bar"));


      Any suggestions?

        • 1. Re: Get *Context from Servlet
          Dustin Norlander Apprentice

          check out section 25.1.4. of the docs:

          Context management for custom servlets
          
          Requests sent direct to some servlet other than the JSF servlet are not processed through the JSF lifecycle, so
          Seam provides a servlet filter that can be applied to any other servlet that needs access to Seam components.
          ...
          


          • 2. Re: Get *Context from Servlet
            ewfolf Newbie

            Cool shit, it works!
            Sadly the conversationId within my IFrame is not the same as the one where it is embedded.

            Any clue?

            • 3. Re: Get *Context from Servlet
              ewfolf Newbie

              After adding

              <web:context-filter url-pattern="/upload/*" />
              to components.xml, I can access the various Seam Contexts.

              However, my ServletRequestContext doesn't have the uploaded file anymore.
              Is there another way to access the Seam Contexts or a plausible explanation for my issue?

              • 4. Re: Get *Context from Servlet
                ewfolf Newbie

                 

                "ewfolf" wrote:
                Cool shit, it works!
                Sadly the conversationId within my IFrame is not the same as the one where it is embedded.

                Any clue?


                Solved quoted issue!
                IFrame src property:
                ?conversationId=#{conversation.id}


                Form action within IFrame file
                ?conversationId=#{param['conversationId']}


                The other one is already open.
                Any ideas greatly appreciated!