0 Replies Latest reply on Aug 16, 2010 7:08 AM by Kamil Hadiyev

    How to get Seam component from servlet.Application with Spring 3.

    Kamil Hadiyev Newbie
      I use Spring 3.0.0.RELEASE, Spring Security and Seam 2.2.0.GA
      I try to get Session Seam Component. But All fields  of Component are null.
      My code:

      public class DocHttpServletRequest extends ContextualHttpServletRequest
      {
           private Sbean sbean;

           public DocHttpServletRequest (HttpServletRequest request)
           {
                super(request);
           }

           @Override
           public void process() throws Exception
           {
                 sbean= (Sbean )Component.getInstance(Sbean.BEAN_NAME);
           }

           public Sbean getSbean ()
           {
                return sbean ;
           }
      }

      Code in servlet:
      Sbean getSbean()
      {
      Sbean result = null;
      DocHttpServletRequest docHttpServletRequest = new DocHttpServletRequest (request);
                     try
                     {
                          docHttpServletRequest .run();
                          result = docHttpServletRequest.getSbean();
                     }
                     catch (ServletException e)
                     {
                          throw new RuntimeException(e);
                     }
                     catch (IOException e)
                     {
                          throw new RuntimeException(e);
                     }
      return result;
      }