You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/03/04 16:45:59 UTC

svn commit: r383141 - /incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java

Author: jboynes
Date: Sat Mar  4 07:45:59 2006
New Revision: 383141

URL: http://svn.apache.org/viewcvs?rev=383141&view=rev
Log:
cosmetic, and we only need to hit HttpSession once

Modified:
    incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java

Modified: incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java?rev=383141&r1=383140&r2=383141&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java (original)
+++ incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java Sat Mar  4 07:45:59 2006
@@ -18,7 +18,7 @@
 
 import java.io.IOException;
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
@@ -29,12 +29,11 @@
 
 import org.apache.tuscany.core.context.AggregateContext;
 import org.apache.tuscany.core.context.EventContext;
-import org.apache.tuscany.core.context.EventException;
 import org.apache.tuscany.core.context.webapp.LazyHTTPSessionId;
 
 /**
  * Valve that can be added to a pipeline to automatically set the SCA environment as each request is processed.
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class TuscanyValve extends ValveBase {
@@ -64,17 +63,16 @@
             } else {
                 // tell the runtime a new request is starting
                 Object requestId = new Object();
-                // jfm
-                if (request.getSession(false) != null) {
+
+                HttpSession session = request.getSession(false);
+                if (session != null) {
                     // A session is already active
-                    moduleComponentContext
-                            .fireEvent(EventContext.SESSION_NOTIFY, ((HttpServletRequest) request).getSession(true));
+                    moduleComponentContext .fireEvent(EventContext.SESSION_NOTIFY, session);
                 } else {
                     // Create a lazy wrapper since a session is not yet active
-                    moduleComponentContext.fireEvent(EventContext.SESSION_NOTIFY, new LazyHTTPSessionId(
-                            (HttpServletRequest) request));
+                    moduleComponentContext.fireEvent(EventContext.SESSION_NOTIFY, new LazyHTTPSessionId(request));
                 }
-                // jfm
+
                 try {
                     moduleComponentContext.fireEvent(EventContext.REQUEST_START, requestId);
                 } catch (Exception e) {