mirror of https://github.com/apache/cloudstack.git
Revert "Temporarily disable the code to retrieve session cookie from WS call for"
This reverts commit dad20a2753.
This commit is contained in:
parent
dad20a2753
commit
9aa624a039
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue