Updated Branches:
  refs/heads/master dad20a275 -> 9aa624a03

Revert "Temporarily disable the code to retrieve session cookie from WS call 
for"

This reverts commit dad20a27537f424abc528a723fe1d308b88ab5ad.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/9aa624a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9aa624a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9aa624a0

Branch: refs/heads/master
Commit: 9aa624a039dfe751398a28d006f605a033b33703
Parents: dad20a2
Author: Min Chen <[email protected]>
Authored: Tue Mar 5 22:02:27 2013 -0800
Committer: Min Chen <[email protected]>
Committed: Tue Mar 5 22:02:27 2013 -0800

----------------------------------------------------------------------
 .../hypervisor/vmware/util/VmwareContext.java      |   21 +++++----------
 1 files changed, 7 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9aa624a0/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
----------------------------------------------------------------------
diff --git 
a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java 
b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
index c1139ee..091ce77 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
@@ -38,8 +38,8 @@ import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLSession;
 import javax.xml.ws.BindingProvider;
-//import com.sun.xml.internal.ws.transport.http.client.CookieJar;
-//import com.sun.xml.internal.ws.client.BindingProviderProperties;
+import com.sun.xml.internal.ws.transport.http.client.CookieJar;
+import com.sun.xml.internal.ws.client.BindingProviderProperties;
 
 import org.apache.log4j.Logger;
 
@@ -381,14 +381,12 @@ public class VmwareContext {
                        long totalBytesDownloaded, ActionDelegate 
progressUpdater) throws Exception {
                HttpURLConnection conn = getRawHTTPConnection(urlString);
 
-               /* TODO: need to find a way working for JDK7 since CookieJar is 
not available in JDK7.
                CookieJar cookie = getServiceCookie();
         if ( cookie == null ){
             s_logger.error("No cookie is found in vwware web service request 
context!");
             throw new Exception("No cookie is found in vmware web service 
request context!");
         }
                cookie.applyRelevantCookies(conn);
-               */
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setAllowUserInteraction(true);
@@ -539,7 +537,11 @@ public class VmwareContext {
        }
 
        public HttpURLConnection getHTTPConnection(String urlString, String 
httpMethod) throws Exception {
-
+               CookieJar cookie = getServiceCookie();
+               if ( cookie == null ){
+                   s_logger.error("No cookie is found in vmware web service 
request context!");
+            throw new Exception("No cookie is found in vmware web service 
request context!");
+               }
            HostnameVerifier hv = new HostnameVerifier() {
                @Override
             public boolean verify(String urlHostName, SSLSession session) {
@@ -554,14 +556,7 @@ public class VmwareContext {
            conn.setDoInput(true);
            conn.setDoOutput(true);
            conn.setAllowUserInteraction(true);
-           /* TODO: need to find a way to work for JDK7 since CookieJar is not 
available in JDK7.
-        CookieJar cookie = getServiceCookie();
-        if ( cookie == null ){
-            s_logger.error("No cookie is found in vmware web service request 
context!");
-            throw new Exception("No cookie is found in vmware web service 
request context!");
-        }
            cookie.applyRelevantCookies(conn);
-           */
            conn.setRequestMethod(httpMethod);
         connectWithRetry(conn);
            return conn;
@@ -580,13 +575,11 @@ public class VmwareContext {
            return (HttpURLConnection)url.openConnection();
        }
 
-       /*TODO: find a way to get session cookie from a WS call
        private CookieJar getServiceCookie() throws Exception {
                VimPortType port = getService();
         Map<String, Object> ctxt = ((BindingProvider) 
port).getRequestContext();
         return (CookieJar)ctxt.get(BindingProviderProperties.HTTP_COOKIE_JAR);
        }
-       */
 
        private static void connectWithRetry(HttpURLConnection conn) throws 
Exception {
            boolean connected = false;

Reply via email to