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 2017/03/16 13:06:52 UTC
[04/12] cxf git commit: Add reflection for HTTPS unknown verbs (at
least for Oracle Java8)
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/29e52bcc
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/29e52bcc
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/29e52bcc
Branch: refs/heads/3.0.x-fixes
Commit: 29e52bccca22cbeabec97957441d29cec822b9cb
Parents: 53a1d76
Author: Daniel Kulp <dk...@apache.org>
Authored: Tue Jan 24 11:39:10 2017 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 15 14:51:38 2017 -0400
----------------------------------------------------------------------
.../http/URLConnectionHTTPConduit.java | 22 ++++++++++++++++++++
1 file changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/29e52bcc/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 b3d9a2d..d8e2958 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) {