deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ch...@apache.org
Subject deltaspike git commit: DELTASPIKE-949 RequestResponseHolderListener should be deactivatable
Date Mon, 13 Jul 2015 07:48:04 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 26ff7d00d -> 53dfedcd9


DELTASPIKE-949 RequestResponseHolderListener should be deactivatable


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/53dfedcd
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/53dfedcd
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/53dfedcd

Branch: refs/heads/master
Commit: 53dfedcd9c84d8708e6f97b2453ba50add1e4762
Parents: 26ff7d0
Author: Christian Kaltepoth <chkal@apache.org>
Authored: Mon Jul 13 08:54:32 2015 +0200
Committer: Christian Kaltepoth <chkal@apache.org>
Committed: Mon Jul 13 08:54:32 2015 +0200

----------------------------------------------------------------------
 .../produce/RequestResponseHolderListener.java  | 22 +++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/53dfedcd/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/produce/RequestResponseHolderListener.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/produce/RequestResponseHolderListener.java
b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/produce/RequestResponseHolderListener.java
index a913436..70296be 100644
--- a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/produce/RequestResponseHolderListener.java
+++ b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/produce/RequestResponseHolderListener.java
@@ -18,25 +18,41 @@
  */
 package org.apache.deltaspike.servlet.impl.produce;
 
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+import org.apache.deltaspike.core.util.ClassDeactivationUtils;
+
 import javax.servlet.ServletRequestEvent;
 import javax.servlet.ServletRequestListener;
 
 /**
  * This class stores the ServletRequest in the {@link RequestResponseHolder}.
  */
-public class RequestResponseHolderListener implements ServletRequestListener
+public class RequestResponseHolderListener implements ServletRequestListener, Deactivatable
 {
 
+    private final boolean activated;
+
+    public RequestResponseHolderListener()
+    {
+        this.activated = ClassDeactivationUtils.isActivated(this.getClass());
+    }
+
     @Override
     public void requestInitialized(ServletRequestEvent sre)
     {
-        RequestResponseHolder.REQUEST.bind(sre.getServletRequest());
+        if (activated)
+        {
+            RequestResponseHolder.REQUEST.bind(sre.getServletRequest());
+        }
     }
 
     @Override
     public void requestDestroyed(ServletRequestEvent sre)
     {
-        RequestResponseHolder.REQUEST.release();
+        if (activated)
+        {
+            RequestResponseHolder.REQUEST.release();
+        }
     }
 
 }


Mime
View raw message