cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6771] Checking ContextProvider before Servlet contexts are initialized from the message
Date Wed, 10 Feb 2016 10:58:41 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a75df553a -> b6b48c1bc


[CXF-6771] Checking ContextProvider before Servlet contexts are initialized from the message


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

Branch: refs/heads/3.1.x-fixes
Commit: b6b48c1bca784fd0e84c6e74223f0d535f4c7ec6
Parents: a75df55
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Feb 10 10:57:38 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Feb 10 10:58:24 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java    | 13 ++++++-------
 .../apache/cxf/jaxrs/ext/MessageContextImplTest.java   |  8 ++++----
 .../org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java     |  2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b6b48c1b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 5b3a808..4a8d761 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -1103,16 +1103,15 @@ public final class JAXRSUtils {
             ProviderInfo<?> providerInfo = 
                 (ProviderInfo<?>)contextMessage.getExchange().getEndpoint().get(Application.class.getName());
             o = providerInfo == null ? null : providerInfo.getProvider();
+        } else if (contextMessage != null) {
+            ContextProvider<?> provider = 
+                ProviderFactory.getInstance(contextMessage).createContextProvider(clazz,
contextMessage);
+            if (provider != null) {
+                o = provider.createContext(contextMessage);
+            }
         }
         if (o == null && contextMessage != null && !MessageUtils.isRequestor(contextMessage))
{
             o = createServletResourceValue(contextMessage, clazz);
-            if (o == null) {
-                ContextProvider<?> provider = 
-                    ServerProviderFactory.getInstance(m).createContextProvider(clazz, contextMessage);
-                if (provider != null) {
-                    o = provider.createContext(contextMessage);
-                }
-            }
         }
         return clazz.cast(o);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b6b48c1b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/MessageContextImplTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/MessageContextImplTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/MessageContextImplTest.java
index 64fcd48..0477192 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/MessageContextImplTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/MessageContextImplTest.java
@@ -123,7 +123,7 @@ public class MessageContextImplTest extends Assert {
     
     @Test
     public void testHttpRequest() {
-        Message m = new MessageImpl();
+        Message m = createMessage();
         MessageContext mc = new MessageContextImpl(m);
         HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
         m.put(AbstractHTTPDestination.HTTP_REQUEST, request);
@@ -136,7 +136,7 @@ public class MessageContextImplTest extends Assert {
     
     @Test
     public void testHttpResponse() {
-        Message m = new MessageImpl();
+        Message m = createMessage();
         MessageContext mc = new MessageContextImpl(m);
         HttpServletResponse request = EasyMock.createMock(HttpServletResponse.class);
         m.put(AbstractHTTPDestination.HTTP_RESPONSE, request);
@@ -148,7 +148,7 @@ public class MessageContextImplTest extends Assert {
     
     @Test
     public void testServletContext() {
-        Message m = new MessageImpl();
+        Message m = createMessage();
         MessageContext mc = new MessageContextImpl(m);
         ServletContext request = EasyMock.createMock(ServletContext.class);
         m.put(AbstractHTTPDestination.HTTP_CONTEXT, request);
@@ -158,7 +158,7 @@ public class MessageContextImplTest extends Assert {
     
     @Test
     public void testServletConfig() {
-        Message m = new MessageImpl();
+        Message m = createMessage();
         MessageContext mc = new MessageContextImpl(m);
         ServletConfig request = EasyMock.createMock(ServletConfig.class);
         m.put(AbstractHTTPDestination.HTTP_CONFIG, request);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b6b48c1b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
index 0cd52fc..1b1ad92 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
@@ -1711,7 +1711,7 @@ public class JAXRSUtilsTest extends Assert {
         EasyMock.replay(context);
         EasyMock.replay(config);
         
-        Message m = new MessageImpl();
+        Message m = createMessage();
         m.put(AbstractHTTPDestination.HTTP_REQUEST, request);
         m.put(AbstractHTTPDestination.HTTP_RESPONSE, response);
         m.put(AbstractHTTPDestination.HTTP_CONTEXT, context);


Mime
View raw message