tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: supporting @Context ResourceInfo
Date Thu, 06 Nov 2014 20:01:05 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop 1d55b1f89 -> bdd8fd5b2


supporting @Context ResourceInfo


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

Branch: refs/heads/develop
Commit: bdd8fd5b256bfdf938545587e053a64bc2ba8ef7
Parents: 1d55b1f
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Thu Nov 6 20:00:03 2014 +0000
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Thu Nov 6 20:00:03 2014 +0000

----------------------------------------------------------------------
 .../openejb/assembler/classic/JndiEncBuilder.java      |  5 +++++
 .../apache/openejb/rest/ThreadLocalContextManager.java | 13 ++++++++++++-
 .../org/apache/openejb/server/cxf/rs/Contexts.java     |  8 ++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/bdd8fd5b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
index f670ad7..c3ca786 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
@@ -71,6 +71,7 @@ import javax.transaction.TransactionManager;
 import javax.transaction.UserTransaction;
 import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
+import javax.ws.rs.core.Configuration;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Request;
 import javax.ws.rs.core.SecurityContext;
@@ -327,6 +328,10 @@ public class JndiEncBuilder {
                     reference = new ObjectReference(ThreadLocalContextManager.SERVLET_CONTEXT);
                 } else if (HttpServletResponse.class.equals(type)) {
                     reference = new ObjectReference(ThreadLocalContextManager.HTTP_SERVLET_RESPONSE);
+                } else if (javax.ws.rs.container.ResourceInfo.class.equals(type)) {
+                    reference = new ObjectReference(ThreadLocalContextManager.RESOURCE_INFO);
+                } else if (Configuration.class.equals(type)) {
+                    reference = new ObjectReference(ThreadLocalContextManager.CONFIGURATION);
                 } else {
                     reference = new MapObjectReference(ThreadLocalContextManager.OTHERS,
referenceInfo.referenceType);
                 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/bdd8fd5b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
index c457d9c..743f94b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/rest/ThreadLocalContextManager.java
@@ -22,7 +22,9 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.container.ResourceInfo;
 import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Configuration;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Request;
 import javax.ws.rs.core.SecurityContext;
@@ -44,7 +46,8 @@ public class ThreadLocalContextManager {
     public static final ThreadLocalContextResolver CONTEXT_RESOLVER = new ThreadLocalContextResolver();
     public static final ThreadLocalProviders PROVIDERS = new ThreadLocalProviders();
     public static final ThreadLocal<Application> APPLICATION = new ThreadLocal<>();
-    public static final ThreadLocal<Application> CONFIGURATION = new ThreadLocal<Application>();
+    public static final ThreadLocal<Configuration> CONFIGURATION = new ThreadLocal<>();
+    public static final ThreadLocal<ResourceInfo> RESOURCE_INFO = new ThreadLocal<>();
     public static final ThreadLocal<Map<String, Object>> OTHERS = new ThreadLocal<Map<String,
Object>>();
 
     public static void reset() {
@@ -60,6 +63,8 @@ public class ThreadLocalContextManager {
         CONTEXT_RESOLVER.remove();
         PROVIDERS.remove();
         APPLICATION.remove();
+        CONFIGURATION.remove();
+        RESOURCE_INFO.remove();
 
         final Map<String, Object> map = OTHERS.get();
         if (map != null) {
@@ -91,6 +96,12 @@ public class ThreadLocalContextManager {
             return ThreadLocalContextManager.SERVLET_CONFIG;
         } else if (ServletContext.class.equals(type)) {
             return ThreadLocalContextManager.SERVLET_CONTEXT;
+        } else if (ResourceInfo.class.equals(type)) {
+            return ThreadLocalContextManager.REQUEST;
+        } else if (Application.class.equals(type)) {
+            return ThreadLocalContextManager.APPLICATION;
+        } else if (Configuration.class.equals(type)) {
+            return ThreadLocalContextManager.CONFIGURATION;
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/bdd8fd5b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/Contexts.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/Contexts.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/Contexts.java
index f08adc7..fc207bc 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/Contexts.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/Contexts.java
@@ -33,7 +33,9 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.container.ResourceInfo;
 import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Configuration;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Request;
@@ -162,6 +164,12 @@ public final class Contexts {
             } else if (ServletConfig.class.equals(type)) {
                 final ServletConfig servletConfig = JAXRSUtils.createContextValue(exchange.getInMessage(),
null, ServletConfig.class);
                 ThreadLocalContextManager.SERVLET_CONFIG.set(servletConfig);
+            } else if (Configuration.class.equals(type)) {
+                final Configuration config = JAXRSUtils.createContextValue(exchange.getInMessage(),
null, Configuration.class);
+                ThreadLocalContextManager.CONFIGURATION.set(config);
+            } else if (ResourceInfo.class.equals(type)) {
+                final ResourceInfo config = JAXRSUtils.createContextValue(exchange.getInMessage(),
null, ResourceInfo.class);
+                ThreadLocalContextManager.RESOURCE_INFO.set(config);
             } else {
                 final Message message = exchange.getInMessage();
                 final ContextProvider<?> provider = ProviderFactory.getInstance(message).createContextProvider(type,
message);


Mime
View raw message