airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1429054 [1/2] - in /airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest: client/ utils/
Date Fri, 04 Jan 2013 19:38:38 GMT
Author: chathuri
Date: Fri Jan  4 19:38:38 2013
New Revision: 1429054

URL: http://svn.apache.org/viewvc?rev=1429054&view=rev
Log:
fixing AIRAVATA-699

Added:
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/CookieManager.java
Modified:
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java?rev=1429054&r1=1429053&r2=1429054&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java Fri Jan  4 19:38:38 2013
@@ -35,6 +35,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
+import org.apache.airavata.rest.utils.CookieManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -59,6 +60,7 @@ public class BasicRegistryResourceClient
     private Cookie cookie;
     private WebResource.Builder builder;
     private String gatewayName;
+//    private CookieManager cookieManager = new CookieManager();
 
     /**
      * Creates a BasicRegistryResourceClient
@@ -70,11 +72,13 @@ public class BasicRegistryResourceClient
     public BasicRegistryResourceClient(String userName,
                                        String gateway,
                                        String seriveURI,
-                                       PasswordCallback callback) {
+                                       PasswordCallback callback,
+                                       Cookie cookie) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = seriveURI;
         this.gatewayName = gateway;
+        this.cookie = cookie;
     }
 
     /**
@@ -121,6 +125,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -136,6 +141,7 @@ public class BasicRegistryResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -164,6 +170,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -178,6 +185,7 @@ public class BasicRegistryResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -206,6 +214,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -221,6 +230,7 @@ public class BasicRegistryResourceClient
             } else if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -248,6 +258,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -263,6 +274,7 @@ public class BasicRegistryResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -290,6 +302,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -305,6 +318,7 @@ public class BasicRegistryResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -334,6 +348,7 @@ public class BasicRegistryResourceClient
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
                 builder = BasicAuthHeaderUtil.getBuilder(
@@ -349,6 +364,7 @@ public class BasicRegistryResourceClient
                 } else {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else {
@@ -385,6 +401,7 @@ public class BasicRegistryResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -400,6 +417,7 @@ public class BasicRegistryResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java?rev=1429054&r1=1429053&r2=1429054&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java Fri Jan  4 19:38:38 2013
@@ -34,6 +34,7 @@ import org.apache.airavata.rest.mappings
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
+import org.apache.airavata.rest.utils.CookieManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,12 +57,18 @@ public class ConfigurationResourceClient
     private WebResource.Builder builder;
     private ClientResponse response;
     private String gateway;
+//    private CookieManager cookieManager = new CookieManager();
 
-    public ConfigurationResourceClient(String userName, String gateway, String seriveURI, PasswordCallback callback) {
+    public ConfigurationResourceClient(String userName,
+                                       String gateway,
+                                       String seriveURI,
+                                       PasswordCallback callback,
+                                       Cookie cookie) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = seriveURI;
         this.gateway = gateway;
+        this.cookie = cookie;
     }
 
     private URI getBaseURI() {
@@ -95,6 +102,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -114,6 +122,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -141,6 +150,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -161,6 +171,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -197,6 +208,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -213,6 +225,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -241,6 +254,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(webResource, null,
@@ -256,6 +270,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -279,6 +294,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -293,6 +309,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -317,6 +334,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -331,6 +349,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -354,6 +373,7 @@ public class ConfigurationResourceClient
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
                 builder = BasicAuthHeaderUtil.getBuilder(
@@ -372,6 +392,7 @@ public class ConfigurationResourceClient
                 } else {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else {
@@ -407,6 +428,7 @@ public class ConfigurationResourceClient
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
                 builder = BasicAuthHeaderUtil.getBuilder(
@@ -425,6 +447,7 @@ public class ConfigurationResourceClient
                 } else {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else {
@@ -459,6 +482,7 @@ public class ConfigurationResourceClient
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
                 builder = BasicAuthHeaderUtil.getBuilder(
@@ -477,6 +501,7 @@ public class ConfigurationResourceClient
                 } else {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else {
@@ -507,6 +532,7 @@ public class ConfigurationResourceClient
                 if (response.getCookies().size() > 0) {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
@@ -526,6 +552,7 @@ public class ConfigurationResourceClient
                 } else {
                     if (response.getCookies().size() > 0) {
                         cookie = response.getCookies().get(0).toCookie();
+                        CookieManager.setCookie(cookie);
                     }
                 }
             } else {
@@ -557,6 +584,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -571,6 +599,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -595,6 +624,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -609,6 +639,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -633,6 +664,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -647,6 +679,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -671,6 +704,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -685,6 +719,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -712,6 +747,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -726,6 +762,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -753,6 +790,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -767,6 +805,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -794,6 +833,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -808,6 +848,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -834,6 +875,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -848,6 +890,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -871,6 +914,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -885,6 +929,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -906,6 +951,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -920,6 +966,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -943,6 +990,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -957,6 +1005,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -978,6 +1027,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -992,6 +1042,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -1013,6 +1064,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1027,6 +1079,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -1048,6 +1101,7 @@ public class ConfigurationResourceClient
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1062,6 +1116,7 @@ public class ConfigurationResourceClient
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java?rev=1429054&r1=1429053&r2=1429054&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java Fri Jan  4 19:38:38 2013
@@ -38,6 +38,7 @@ import org.apache.airavata.rest.mappings
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
+import org.apache.airavata.rest.utils.CookieManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,12 +61,18 @@ public class DescriptorResourceClient {
     private Cookie cookie;
     private WebResource.Builder builder;
     private String gateway;
+//    private CookieManager cookieManager = new CookieManager();
 
-    public DescriptorResourceClient(String userName, String gateway, String serviceURI, PasswordCallback callback) {
+    public DescriptorResourceClient(String userName,
+                                    String gateway,
+                                    String serviceURI,
+                                    PasswordCallback callback,
+                                    Cookie cookie) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = serviceURI;
         this.gateway = gateway;
+        this.cookie = cookie;
     }
 
     private URI getBaseURI() {
@@ -98,6 +105,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -113,6 +121,7 @@ public class DescriptorResourceClient {
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
 
@@ -145,6 +154,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -163,6 +173,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         }else if (status == ClientConstant.HTTP_BAD_REQUEST){
@@ -191,6 +202,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -207,6 +219,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -233,6 +246,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -252,6 +266,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST) {
@@ -281,6 +296,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -295,6 +311,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -319,6 +336,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -338,6 +356,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -373,6 +392,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -390,6 +410,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -418,6 +439,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -433,6 +455,7 @@ public class DescriptorResourceClient {
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
             String exists = response.getEntity(String.class);
@@ -463,6 +486,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -482,6 +506,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST){
@@ -509,6 +534,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -524,6 +550,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -549,6 +576,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -565,6 +593,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST) {
@@ -594,6 +623,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -608,6 +638,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -631,6 +662,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -648,6 +680,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -686,6 +719,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -701,6 +735,7 @@ public class DescriptorResourceClient {
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
             String exists = response.getEntity(String.class);
@@ -737,6 +772,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -755,6 +791,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST){
@@ -789,6 +826,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -807,6 +845,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST){
@@ -840,6 +879,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -855,6 +895,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -886,6 +927,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -901,6 +943,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -931,6 +974,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -948,6 +992,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_BAD_REQUEST) {
@@ -982,6 +1027,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1000,6 +1046,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -1033,6 +1080,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1051,6 +1099,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -1090,6 +1139,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1108,6 +1158,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -1146,6 +1197,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1164,6 +1216,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -1197,6 +1250,7 @@ public class DescriptorResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -1211,6 +1265,7 @@ public class DescriptorResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java?rev=1429054&r1=1429053&r2=1429054&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java Fri Jan  4 19:38:38 2013
@@ -34,6 +34,7 @@ import org.apache.airavata.rest.mappings
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
+import org.apache.airavata.rest.utils.CookieManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,15 +58,18 @@ public class ExperimentResourceClient {
     private Cookie cookie;
     private WebResource.Builder builder;
     private String gateway;
+//    private CookieManager cookieManager = new CookieManager();
 
     public ExperimentResourceClient(String userName,
                                     String gateway,
                                     String serviceURI,
-                                    PasswordCallback callback) {
+                                    PasswordCallback callback,
+                                    Cookie cookie) {
         this.userName = userName;
         this.callback = callback;
         this.baseURI = serviceURI;
         this.gateway = gateway;
+        this.cookie = cookie;
     }
 
     private URI getBaseURI() {
@@ -103,6 +107,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -118,6 +123,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -140,6 +146,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -154,6 +161,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -176,6 +184,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -195,6 +204,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -230,6 +240,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -248,6 +259,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -287,6 +299,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -306,6 +319,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -344,6 +358,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -362,6 +377,7 @@ public class ExperimentResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -395,6 +411,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -410,6 +427,7 @@ public class ExperimentResourceClient {
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
             String exists = response.getEntity(String.class);
@@ -444,6 +462,7 @@ public class ExperimentResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -460,6 +479,7 @@ public class ExperimentResourceClient {
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
             String exists = response.getEntity(String.class);

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java?rev=1429054&r1=1429053&r2=1429054&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java Fri Jan  4 19:38:38 2013
@@ -34,6 +34,7 @@ import org.apache.airavata.rest.mappings
 import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
 import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
 import org.apache.airavata.rest.utils.ClientConstant;
+import org.apache.airavata.rest.utils.CookieManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,12 +55,18 @@ public class ProjectResourceClient {
     private Cookie cookie;
     private WebResource.Builder builder;
     private String gateway;
+//    private CookieManager cookieManager = new CookieManager();
 
-    public ProjectResourceClient(String userName, String gateway, String serviceURI, PasswordCallback callback) {
+    public ProjectResourceClient(String userName,
+                                 String gateway,
+                                 String serviceURI,
+                                 PasswordCallback callback,
+                                 Cookie cookie) {
         this.callback = callback;
         this.userName = userName;
         this.baseURI = serviceURI;
         this.gateway = gateway;
+        this.cookie = cookie;
     }
 
     private URI getBaseURI() {
@@ -140,6 +147,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
             String exists = response.getEntity(String.class);
             if (exists.equals("True")) {
@@ -151,11 +159,11 @@ public class ProjectResourceClient {
             builder = BasicAuthHeaderUtil.getBuilder(
                     webResource, null, userName, callback.getPassword(userName), null, gateway);
             response = builder.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
-            cookie = response.getCookies().get(0).toCookie();
             status = response.getStatus();
             if (status == ClientConstant.HTTP_OK) {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
             String exists = response.getEntity(String.class);
@@ -185,6 +193,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -199,6 +208,7 @@ public class ProjectResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -222,6 +232,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -236,6 +247,7 @@ public class ProjectResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -258,6 +270,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -271,6 +284,7 @@ public class ProjectResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else {
@@ -293,6 +307,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -309,6 +324,7 @@ public class ProjectResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {
@@ -335,6 +351,7 @@ public class ProjectResourceClient {
         if (status == ClientConstant.HTTP_OK) {
             if (response.getCookies().size() > 0) {
                 cookie = response.getCookies().get(0).toCookie();
+                CookieManager.setCookie(cookie);
             }
         } else if (status == ClientConstant.HTTP_UNAUTHORIZED) {
             builder = BasicAuthHeaderUtil.getBuilder(
@@ -351,6 +368,7 @@ public class ProjectResourceClient {
             } else {
                 if (response.getCookies().size() > 0) {
                     cookie = response.getCookies().get(0).toCookie();
+                    CookieManager.setCookie(cookie);
                 }
             }
         } else if (status == ClientConstant.HTTP_NO_CONTENT) {



Mime
View raw message