[seam-commits] Seam SVN: r12688 - in modules/servlet/trunk: impl/src/main/java/org/jboss/seam/servlet/http and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu May 6 18:16:27 EDT 2010
Author: lincolnthree
Date: 2010-05-06 18:16:27 -0400 (Thu, 06 May 2010)
New Revision: 12688
Modified:
modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/http/HttpServletEnvironmentProducer.java
modules/servlet/trunk/pom.xml
Log:
Fixed Servlet Listener ordering issues - still need to fix Weld/AppServers/JavaEE
Modified: modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/http/HttpServletEnvironmentProducer.java
===================================================================
--- modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/http/HttpServletEnvironmentProducer.java 2010-05-06 22:04:23 UTC (rev 12687)
+++ modules/servlet/trunk/impl/src/main/java/org/jboss/seam/servlet/http/HttpServletEnvironmentProducer.java 2010-05-06 22:16:27 UTC (rev 12688)
@@ -23,6 +23,7 @@
import java.io.Serializable;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
@@ -30,9 +31,7 @@
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionEvent;
-import org.jboss.seam.servlet.event.qualifier.Created;
import org.jboss.seam.servlet.event.qualifier.Destroyed;
import org.jboss.seam.servlet.event.qualifier.Initialized;
import org.slf4j.Logger;
@@ -43,42 +42,41 @@
* @author Nicklas Karlsson
*
*/
- at RequestScoped
+ at ApplicationScoped
public class HttpServletEnvironmentProducer implements Serializable
{
private static final long serialVersionUID = 1L;
- private HttpSession session;
- private HttpServletRequest request;
+ private final ThreadLocal<HttpSession> session = new ThreadLocal<HttpSession>();
+ private final ThreadLocal<HttpServletRequest> request = new ThreadLocal<HttpServletRequest>();
@Inject
private Logger log;
- protected void requestInitialized(@Observes @Initialized ServletRequestEvent e)
+ protected void requestInitialized(@Observes @Initialized final ServletRequestEvent e)
{
log.trace("Servlet request initialized with event #0", e);
- request = (HttpServletRequest) e.getServletRequest();
- session = request.getSession();
+ request.set((HttpServletRequest) e.getServletRequest());
+ session.set(request.get().getSession());
}
- protected void requestDestroyed(@Observes @Destroyed ServletRequestEvent e)
+ protected void requestDestroyed(@Observes @Destroyed final ServletRequestEvent e)
{
log.trace("Servlet request destroyed with event #0", e);
- request = null;
}
@Produces
@RequestScoped
protected HttpSession getSession()
{
- return session;
+ return session.get();
}
@Produces
@RequestScoped
protected HttpServletRequest getRequest()
{
- return request;
+ return request.get();
}
}
Modified: modules/servlet/trunk/pom.xml
===================================================================
--- modules/servlet/trunk/pom.xml 2010-05-06 22:04:23 UTC (rev 12687)
+++ modules/servlet/trunk/pom.xml 2010-05-06 22:16:27 UTC (rev 12688)
@@ -3,9 +3,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>seam-parent</artifactId>
- <groupId>org.jboss.seam</groupId>
- <version>3.0.0-SNAPSHOT</version>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-parent</artifactId>
+ <version>9</version>
</parent>
<artifactId>seam-servlet-parent</artifactId>
@@ -27,9 +27,9 @@
<properties>
<arquillian.version>1.0.0.Alpha1</arquillian.version>
- <weld.version>1.0.1-Final</weld.version>
+ <weld.api.version>1.0-SP1</weld.api.version>
<weldx.version>1.0.0-SNAPSHOT</weldx.version>
- </properties>
+ </properties>
<repositories>
<repository>
@@ -44,6 +44,18 @@
</repository>
</repositories>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-api-bom</artifactId>
+ <version>${weld.api.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<!-- Environment Dependencies -->
@@ -67,14 +79,9 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-extensions</artifactId>
- <version>${weldx.version}</version>
+ <version>${weldx.version}</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-core</artifactId>
- <version>${weld.version}</version>
- </dependency>
<!-- Test Dependencies -->
<dependency>
More information about the seam-commits
mailing list