< prev index next >

src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -29,10 +29,11 @@
 import java.net.Proxy;
 import java.net.SecureCacheResponse;
 import java.security.Principal;
 import java.io.IOException;
 import java.util.List;
+import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import sun.net.www.http.*;
 import sun.net.www.protocol.http.HttpURLConnection;
 
 /**

@@ -294,6 +295,17 @@
         } else {
             return (((HttpsClient)http).getLocalPrincipal());
         }
     }
 
+    SSLSession getSSLSession() {
+        if (cachedResponse != null) {
+            return ((SecureCacheResponse)cachedResponse).getSSLSession();
+        }
+
+        if (http == null) {
+            throw new IllegalStateException("connection not yet open");
+        }
+
+        return ((HttpsClient)http).getSSLSession();
+    }
 }
< prev index next >