abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r576481 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
Date Mon, 17 Sep 2007 15:30:01 GMT
Author: jmsnell
Date: Mon Sep 17 08:30:00 2007
New Revision: 576481

URL: http://svn.apache.org/viewvc?rev=576481&view=rev
Log:
Add methods for manually working with cookies. This is just a thin veil on top 
of the commons client methods.

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java?rev=576481&r1=576480&r2=576481&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/AbderaClient.java
Mon Sep 17 08:30:00 2007
@@ -20,6 +20,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,6 +42,7 @@
 import org.apache.abdera.protocol.util.CacheControlUtil;
 import org.apache.abdera.util.ServiceUtil;
 import org.apache.abdera.util.Version;
+import org.apache.commons.httpclient.Cookie;
 import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
@@ -565,5 +567,72 @@
           scheme != null ? scheme : AuthScope.ANY_SCHEME);
       client.getState().setProxyCredentials(
         scope, credentials);
+  }
+  
+  /**
+   * Manually add cookies
+   */
+  public void addCookie(
+    String domain, 
+    String name, 
+    String value) {
+      Cookie cookie = new Cookie(domain,name,value);
+      client.getState().addCookie(cookie);
+  }
+  
+  /**
+   * Manually add cookies
+   */
+  public void addCookie(
+    String domain, 
+    String name, 
+    String value, 
+    String path,
+    Date expires,
+    boolean secure) {
+      Cookie cookie = new Cookie(domain,name,value,path,expires,secure);
+      client.getState().addCookie(cookie);
+  }  
+
+  /**
+   * Manually add cookies
+   */
+  public void addCookie(
+    String domain, 
+    String name, 
+    String value, 
+    String path,
+    int maxAge,
+    boolean secure) {
+      Cookie cookie = new Cookie(domain,name,value,path,maxAge,secure);
+      client.getState().addCookie(cookie);
+  }  
+
+  /**
+   * Manually add cookies
+   */
+  public void addCookies(Cookie cookie) {
+    client.getState().addCookie(cookie);
+  }
+  
+  /**
+   * Manually add cookies
+   */
+  public void addCookies(Cookie... cookies) {
+    client.getState().addCookies(cookies);
+  }
+  
+  /**
+   * Get all the cookies
+   */
+  public Cookie[] getCookies() {
+    return client.getState().getCookies();
+  }
+  
+  /**
+   * Clear the cookies
+   */
+  public void clearCookies() {
+    client.getState().clearCookies();
   }
 }



Mime
View raw message