tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: ensure request scope is initialized a single time in embedded mode
Date Wed, 31 Dec 2014 10:13:24 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop 54237f97a -> 8bd634432


ensure request scope is initialized a single time in embedded mode


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8bd63443
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8bd63443
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8bd63443

Branch: refs/heads/develop
Commit: 8bd6344323f9fd5a57701c8cccccb6a26eab2bbf
Parents: 54237f9
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Wed Dec 31 11:13:03 2014 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Wed Dec 31 11:13:03 2014 +0100

----------------------------------------------------------------------
 .../apache/openejb/server/httpd/HttpRequestImpl.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/8bd63443/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
index aa9a566..b57c174 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
@@ -1194,15 +1194,20 @@ public class HttpRequestImpl implements HttpRequest {
     }
 
     public void setEndListener(final EndWebBeansListener end) {
-        this.end = end;
+        if (this.end == null) {
+            this.end = end;
+        }
     }
 
     public void setBeginListener(final BeginWebBeansListener begin) {
-        this.begin = begin;
+        if (this.begin == null) {
+            this.begin = begin;
+        }
     }
 
     public void init() {
-        if (begin != null) {
+        if (begin != null && getAttribute("openejb_requestInitialized") == null)
{
+            setAttribute("openejb_requestInitialized", "ok"); // if called again we loose
the request scope
             begin.requestInitialized(new ServletRequestEvent(getServletContext(), this));
         }
 
@@ -1222,7 +1227,8 @@ public class HttpRequestImpl implements HttpRequest {
                 listener.requestDestroyed(event);
             }
         }
-        if (end != null) {
+        if (end != null && getAttribute("openejb_requestDestroyed") == null) {
+            setAttribute("openejb_requestDestroyed", "ok");
             end.requestDestroyed(new ServletRequestEvent(getServletContext(), this));
         }
     }


Mime
View raw message