You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2022/06/22 18:01:36 UTC

[cxf] branch 3.6.x-fixes updated (7a4d0b1b6b -> 7fc2c4ca26)

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a change to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


    from 7a4d0b1b6b Update Jetty to 9.4.47.v20220610 (#965)
     new 50679288e5 Fix ws-discovery-api test on MacOS on M1
     new 89e21ca00e Set the Spring HandlerMapping.bestMatchingPattern on the httprequest.  This allows spring metrics to display the uri instead of "UNKNOWN"
     new 8570eaeab7 Update jettison version
     new 7fc2c4ca26 Recording .gitmergeinfo Changes

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                                     | 2 ++
 parent/pom.xml                                                    | 2 +-
 .../java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java | 8 +++++++-
 .../jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java | 7 +++++++
 .../apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java | 2 ++
 .../cxf/transport/http/netty/server/NettyHttpDestinationTest.java | 2 ++
 .../cxf/transport/http_undertow/UndertowHTTPDestinationTest.java  | 2 ++
 .../org/apache/cxf/transport/http/AbstractHTTPDestination.java    | 5 +++++
 .../java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java   | 8 ++++----
 9 files changed, 32 insertions(+), 6 deletions(-)


[cxf] 02/04: Set the Spring HandlerMapping.bestMatchingPattern on the httprequest. This allows spring metrics to display the uri instead of "UNKNOWN"

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 89e21ca00e370618d9551317075687b2cb24426b
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Wed Jun 22 12:33:08 2022 -0400

    Set the Spring HandlerMapping.bestMatchingPattern on the httprequest.  This allows spring metrics to display the uri instead of "UNKNOWN"
---
 .../java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java | 8 +++++++-
 .../jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java | 7 +++++++
 .../apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java | 2 ++
 .../cxf/transport/http/netty/server/NettyHttpDestinationTest.java | 2 ++
 .../cxf/transport/http_undertow/UndertowHTTPDestinationTest.java  | 2 ++
 .../org/apache/cxf/transport/http/AbstractHTTPDestination.java    | 5 +++++
 6 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
index 3c9c5d8e3c..8725280737 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
@@ -239,7 +239,13 @@ public class JAXRSInInterceptor extends AbstractPhaseInterceptor<Message> {
         exchange.put(JAXRSUtils.ROOT_RESOURCE_CLASS, cri);
         message.put(RESOURCE_METHOD, ori.getMethodToInvoke());
         message.put(URITemplate.TEMPLATE_PARAMETERS, values);
-        message.put(URITemplate.URI_TEMPLATE, JAXRSUtils.getUriTemplate(message, cri, ori));
+        
+        
+        String uriTemplate = JAXRSUtils.getUriTemplate(message, cri, ori);
+        message.put(URITemplate.URI_TEMPLATE, uriTemplate);
+        if (HttpUtils.isHttpRequest(message)) {
+            HttpUtils.setHttpRequestURI(message, uriTemplate);
+        }
 
         String plainOperationName = ori.getMethodToInvoke().getName();
         if (numberOfResources > 1) {
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
index 6230b887e6..355adac76a 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/HttpUtils.java
@@ -373,6 +373,13 @@ public final class HttpUtils {
             (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST));
         return URI.create(base + relativePath);
     }
+    
+    public static void setHttpRequestURI(Message message, String uriTemplate) {
+        HttpServletRequest request =
+            (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
+        request.setAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern", uriTemplate);
+    }
+
 
     public static URI toAbsoluteUri(URI u, Message message) {
         HttpServletRequest request =
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
index f2262a2e5b..5d42849d5c 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
@@ -667,6 +667,8 @@ public class JettyHTTPDestinationTest {
                 EasyMock.expect(request.getRequestURI()).andReturn("/foo");
                 EasyMock.expect(request.getRequestURL())
                     .andReturn(new StringBuffer("http://localhost/foo")).anyTimes();
+                request.setAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern", "/foo");
+                EasyMock.expectLastCall();
                 EasyMock.expect(request.getCharacterEncoding()).andReturn(StandardCharsets.UTF_8.name());
                 EasyMock.expect(request.getQueryString()).andReturn(query);
                 EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");
diff --git a/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java b/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
index 7aae458db1..7435599f44 100644
--- a/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
+++ b/rt/transports/http-netty/netty-server/src/test/java/org/apache/cxf/transport/http/netty/server/NettyHttpDestinationTest.java
@@ -663,6 +663,8 @@ public class NettyHttpDestinationTest {
                 EasyMock.expect(request.getRequestURI()).andReturn("/foo");
                 EasyMock.expect(request.getRequestURL())
                     .andReturn(new StringBuffer("http://localhost/foo")).anyTimes();
+                request.setAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern", "/foo");
+                EasyMock.expectLastCall();
                 EasyMock.expect(request.getCharacterEncoding()).andReturn(StandardCharsets.UTF_8.name());
                 EasyMock.expect(request.getQueryString()).andReturn(query).times(2);
                 EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");
diff --git a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
index 77d670c091..eed1d9da40 100644
--- a/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
+++ b/rt/transports/http-undertow/src/test/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestinationTest.java
@@ -666,6 +666,8 @@ public class UndertowHTTPDestinationTest {
                 EasyMock.expect(request.getRequestURI()).andReturn("/foo");
                 EasyMock.expect(request.getRequestURL())
                     .andReturn(new StringBuffer("http://localhost/foo")).anyTimes();
+                request.setAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern", "/foo");
+                EasyMock.expectLastCall();
                 EasyMock.expect(request.getCharacterEncoding()).andReturn(StandardCharsets.UTF_8.name());
                 EasyMock.expect(request.getQueryString()).andReturn(query);
                 EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
index 4bee0d38d4..29f93b81fc 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
@@ -337,6 +337,11 @@ public abstract class AbstractHTTPDestination
         inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
         String requestURI = req.getRequestURI();
         inMessage.put(Message.REQUEST_URI, requestURI);
+        try {
+            req.setAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern", requestURI);
+        } catch (RuntimeException rex) {
+            //ignore, not using Spring so the property is irrelevant
+        }
         String requestURL = req.getRequestURL().toString();
         inMessage.put(Message.REQUEST_URL, requestURL);
         String contextPath = req.getContextPath();


[cxf] 03/04: Update jettison version

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 8570eaeab7e2183a2969a9017895449920df9feb
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Thu Jun 9 13:11:47 2022 -0400

    Update jettison version
    
    (cherry picked from commit a9a32266a14c3956186a63e408d8d75c2f47bb0f)
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 08a72744f4..6e2859990e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -149,7 +149,7 @@
         <cxf.jboss.weld.version>3.1.7.SP1</cxf.jboss.weld.version>
         <cxf.jcache.version>1.1.1</cxf.jcache.version>
         <cxf.jdom.version>1.0</cxf.jdom.version>
-        <cxf.jettison.version>1.4.1</cxf.jettison.version>
+        <cxf.jettison.version>1.5.0</cxf.jettison.version>
         <cxf.jetty.osgi.version>[9.2,10)</cxf.jetty.osgi.version>
         <cxf.jetty9.version>9.4.47.v20220610</cxf.jetty9.version>
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>


[cxf] 04/04: Recording .gitmergeinfo Changes

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 7fc2c4ca26c8615d1c231292dbcd96992e45b2a5
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Wed Jun 22 13:59:40 2022 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 6d0d976951..870e8bfc49 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -13,6 +13,7 @@ B b740e0a7f606d9e5acb8c27dfb3a671708bb19db
 B ba839e6b1f3ee5c26fd600834ea10227dd4cc317
 B cad4f0b76bb79f82a5ef4bc7e435e93996eb884b
 B cfca13411eb72d2d07ca243e24ced6e9743e6124
+B cfe9f430ee617552eb743140cb78cc5df4c4eb83
 B d77fd3ac9eb11bd69e5d534dffe53296e4c00ae8
 M 11502cd9e0f85ded3ae83b3df7226d2e107159ab
 M 18f1791fa72dba0a7f2ed784d0dfbbb5e9923306
@@ -24,6 +25,7 @@ M 7501891ee05153ba43eab3cdadccf789dd15de1e
 M 905f4f91e4d0b5c4d145729f16bad90b1847f0be
 M 96e71237bae2eb987a5fbe67d21e9e1e19f2d158
 M a903a5392b3cd2b5925c6afa46f289b3b94a694a
+M a9a32266a14c3956186a63e408d8d75c2f47bb0f
 M b15e3580e8f8692b2ffd51e6b2c44ce9dd8a5730
 M b207c718e84bed8120bb114f1d79f575094c3a14
 M c5b7db5a4cceb3df6094ee38215725fd4ecc2b8c


[cxf] 01/04: Fix ws-discovery-api test on MacOS on M1

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 50679288e5b8ae75e90ce6d888018a08ad7cd36f
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Wed Jun 22 12:14:14 2022 -0400

    Fix ws-discovery-api test on MacOS on M1
---
 .../java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
index b8a313802c..836f72bc7c 100644
--- a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
+++ b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
@@ -85,7 +85,6 @@ public final class WSDiscoveryClientTest {
             System.out.println("Skipping MultiResponse test for REL");
             return;
         }
-
         Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
         int count = 0;
         if (interfaces != null) {
@@ -109,8 +108,10 @@ public final class WSDiscoveryClientTest {
                     //fake a discovery server to send back some canned messages.
                     InetAddress address = InetAddress.getByName("239.255.255.250");
                     MulticastSocket s = new MulticastSocket(Integer.parseInt(PORT));
+                    if (!"Mac OS X".equals(System.getProperties().getProperty("os.name"))) {
+                        s.setNetworkInterface(findIpv4Interface());
+                    }
                     s.setBroadcast(true);
-                    s.setNetworkInterface(findIpv4Interface());
                     s.setLoopbackMode(false);
                     s.setReuseAddress(true);
                     s.joinGroup(address);
@@ -121,8 +122,7 @@ public final class WSDiscoveryClientTest {
                     s.receive(p);
                     SocketAddress sa = p.getSocketAddress();
                     String incoming = new String(p.getData(), 0, p.getLength(), StandardCharsets.UTF_8);
-                    int idx = incoming.indexOf("MessageID");
-                    idx = incoming.indexOf('>', idx);
+                    int idx = incoming.indexOf('>', incoming.indexOf("MessageID"));
                     incoming = incoming.substring(idx + 1);
                     idx = incoming.indexOf("</");
                     incoming = incoming.substring(0, idx);