[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...

Gavin King gavin.king at jboss.com
Tue Jan 23 13:59:38 EST 2007


  User: gavin   
  Date: 07/01/23 13:59:38

  Modified:    src/main/org/jboss/seam/contexts  Lifecycle.java
  Log:
  fixed typo
  have a conversation context during startup
  create Events earlier
  
  Revision  Changes    Path
  1.77      +22 -7     jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Lifecycle.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -b -r1.76 -r1.77
  --- Lifecycle.java	8 Jan 2007 17:28:19 -0000	1.76
  +++ Lifecycle.java	23 Jan 2007 18:59:38 -0000	1.77
  @@ -30,7 +30,7 @@
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.76 $
  + * @version $Revision: 1.77 $
    */
   public class Lifecycle
   {
  @@ -43,7 +43,7 @@
         Contexts.sessionContext.set( new WebSessionContext( ContextAdaptor.getSession(externalContext) ) );
         Contexts.applicationContext.set( new FacesApplicationContext(externalContext) );
         Contexts.conversationContext.set(null); //in case endRequest() was never called
  -      Events.instance(); //TODO: only for now, until we have a way to do EL outside of JSF!
  +      //Events.instance(); //TODO: only for now, until we have a way to do EL outside of JSF!
      }
   
      public static void beginRequest(ServletContext servletContext, HttpSession session, ServletRequest request) {
  @@ -83,12 +83,12 @@
   
      }
   
  -   public static void beginApplication()
  +   public static void mockApplication()
      {
         Contexts.applicationContext.set( new WebApplicationContext( getServletContext() ) );
      }
   
  -   public static void endApplication()
  +   public static void unmockApplication()
      {
         Contexts.applicationContext.set(null);
      }
  @@ -109,6 +109,7 @@
      {
         Contexts.applicationContext.set( new WebApplicationContext(servletContext) );
         Contexts.eventContext.set( new MapContext(ScopeType.EVENT) );
  +      Contexts.conversationContext.set( new MapContext(ScopeType.CONVERSATION) );
      }
   
      public static void beginExceptionRecovery(ServletContext servletContext, HttpServletRequest request)
  @@ -120,8 +121,7 @@
   
      public static void endInitialization()
      {
  -      //TODO: put this back in when we have non-JSF-dependent EL!
  -      //startup( Component.forName( Seam.getComponentName(Events.class) ) );
  +      startup( Component.forName( Seam.getComponentName(Events.class) ) );
   
   	   //instantiate all application-scoped @Startup components
         Context context = Contexts.getApplicationContext();
  @@ -138,6 +138,8 @@
       	   }
         }
   
  +      Contexts.destroy( Contexts.getConversationContext() );
  +      Contexts.conversationContext.set(null);
         Contexts.destroy( Contexts.getEventContext() );
         Contexts.eventContext.set(null);
         Contexts.applicationContext.set(null);
  @@ -188,6 +190,7 @@
   
         boolean applicationContextActive = Contexts.isApplicationContextActive();
         boolean eventContextActive = Contexts.isEventContextActive();
  +      boolean conversationContextActive = Contexts.isConversationContextActive();
         if ( !applicationContextActive )
         {
            Context tempApplicationContext = new WebApplicationContext(servletContext);
  @@ -197,7 +200,13 @@
         if ( !eventContextActive )
         {
            tempEventContext = new MapContext(ScopeType.EVENT);
  -         Contexts.applicationContext.set(tempEventContext);
  +         Contexts.eventContext.set(tempEventContext);
  +      }
  +      Context tempConversationContext = null;
  +      if ( !conversationContextActive )
  +      {
  +         tempConversationContext = new MapContext(ScopeType.CONVERSATION);
  +         Contexts.conversationContext.set(tempConversationContext);
         }
   
         Context tempSessionContext = new WebSessionContext(session);
  @@ -218,6 +227,12 @@
         }
   
         Contexts.sessionContext.set(null);
  +      
  +      if ( !conversationContextActive )
  +      {
  +         Contexts.destroy(tempConversationContext);
  +         Contexts.conversationContext.set(null);
  +      }
         if ( !eventContextActive ) 
         {
            Contexts.destroy(tempEventContext);
  
  
  



More information about the jboss-cvs-commits mailing list