cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [2/3] cxf git commit: Add reflection for HTTPS unknown verbs (at least for Oracle Java8)
Date Tue, 24 Jan 2017 17:07:56 GMT
Add reflection for HTTPS unknown verbs (at least for Oracle Java8)


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

Branch: refs/heads/3.1.x-fixes
Commit: 98c52c1ae70536580d1f9e4e50d256ba75e2a0ee
Parents: db82c01
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue Jan 24 11:39:10 2017 -0500
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Jan 24 17:07:32 2017 +0000

----------------------------------------------------------------------
 .../http/URLConnectionHTTPConduit.java          | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/98c52c1a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
index bbafdcf..249c735 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
@@ -32,6 +32,8 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.util.logging.Level;
 
+import javax.net.ssl.HttpsURLConnection;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.common.util.SystemPropertyAction;
@@ -146,7 +148,27 @@ public class URLConnectionHTTPConduit extends HTTPConduit {
             }
             if (b) {
                 try {
+                    boolean set = false;
                     java.lang.reflect.Field f = ReflectionUtil.getDeclaredField(HttpURLConnection.class,
"method");
+                    if (connection instanceof HttpsURLConnection) {
+                        try {
+                            java.lang.reflect.Field f2 = ReflectionUtil.getDeclaredField(connection.getClass(),
+                                                                                        
"delegate");
+                            Object c = ReflectionUtil.setAccessible(f2).get(connection);
+                            if (c instanceof HttpURLConnection) {
+                                ReflectionUtil.setAccessible(f).set(c, httpRequestMethod);
+                            }
+
+                            f2 = ReflectionUtil.getDeclaredField(c.getClass(), "httpsURLConnection");
+                            HttpsURLConnection c2 = (HttpsURLConnection)ReflectionUtil.setAccessible(f2)
+                                    .get(c);
+
+                            ReflectionUtil.setAccessible(f).set(c2, httpRequestMethod);
+                        } catch (Throwable t) {
+                            //ignore
+                            t.printStackTrace();
+                        }
+                    }
                     ReflectionUtil.setAccessible(f).set(connection, httpRequestMethod);
                     message.put(HTTPURL_CONNECTION_METHOD_REFLECTION, true);
                 } catch (Throwable t) {


Mime
View raw message