[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...
Gavin King
gavin.king at jboss.com
Sat Sep 23 08:29:18 EDT 2006
User: gavin
Date: 06/09/23 08:29:18
Modified: src/main/org/jboss/seam/contexts Lifecycle.java
Log:
fix JBSEAM-338
Revision Changes Path
1.50 +16 -6 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.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- Lifecycle.java 18 Sep 2006 22:40:53 -0000 1.49
+++ Lifecycle.java 23 Sep 2006 12:29:18 -0000 1.50
@@ -27,7 +27,7 @@
/**
* @author Gavin King
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision: 1.49 $
+ * @version $Revision: 1.50 $
*/
public class Lifecycle
{
@@ -64,11 +64,6 @@
{
log.debug( ">>> Begin call" );
ServletContext servletContext = getServletContext();
- if (servletContext==null)
- {
- throw new IllegalStateException("Attempted to invoke a Seam component outside the context of a web application");
- }
-
Contexts.eventContext.set( new MapContext(ScopeType.EVENT) );
Contexts.sessionContext.set( new MapContext(ScopeType.SESSION) );
Contexts.conversationContext.set( new MapContext(ScopeType.CONVERSATION) );
@@ -95,6 +90,17 @@
}
+ public static void beginApplication()
+ {
+ Contexts.applicationContext.set( new WebApplicationContext( getServletContext() ) );
+ }
+
+ public static void endApplication()
+ {
+ Contexts.applicationContext.set(null);
+ }
+
+
public static void beginInitialization(ServletContext servletContext)
{
Contexts.applicationContext.set( new WebApplicationContext(servletContext) );
@@ -389,6 +395,10 @@
private static ServletContext servletContext;
public static ServletContext getServletContext() {
+ if (servletContext==null)
+ {
+ throw new IllegalStateException("Attempted to invoke a Seam component outside the context of a web application");
+ }
return servletContext;
}
More information about the jboss-cvs-commits
mailing list