abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eli...@apache.org
Subject svn commit: r416539 - in /incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient: AtomClient.java RequestOptions.java
Date Fri, 23 Jun 2006 01:41:21 GMT
Author: eliast
Date: Thu Jun 22 18:41:21 2006
New Revision: 416539

URL: http://svn.apache.org/viewvc?rev=416539&view=rev
Log:
- Added accessor to requestHeaders Map in RequestOptions
- Fixed _invoke method in AtomClient to set custom request headers.

Modified:
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/RequestOptions.java

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java?rev=416539&r1=416538&r2=416539&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
(original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/AtomClient.java
Thu Jun 22 18:41:21 2006
@@ -24,6 +24,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Date;
+import java.util.Map;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.InflaterInputStream;
 import java.util.zip.ZipInputStream;
@@ -574,6 +575,7 @@
       throws HttpException, 
              IOException {
     if (options != null) {
+
       if (!options.getAllowCache())
         method.setRequestHeader(
           "Cache-Control", 
@@ -600,6 +602,14 @@
             options.getIfModifiedSince()));
       if (options.getUseDeltaEncoding()) 
         method.setRequestHeader("A-IM", "feed");
+      
+      // Lastly, set all custom headers    
+      Map<String, String> custom = options.getRequestHeaders();
+      
+      for(String key : custom.keySet() ) {
+        method.setRequestHeader(key, custom.get(key));
+      }
+            
     }
     int status = client.executeMethod(method);
     if (options != null && options.getCaptureResponseHeaders()) {

Modified: incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/RequestOptions.java?rev=416539&r1=416538&r2=416539&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/RequestOptions.java
(original)
+++ incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/RequestOptions.java
Thu Jun 22 18:41:21 2006
@@ -108,4 +108,9 @@
   public void setCaptureResponseHeaders(boolean capture) {
     this.captureResponseHeaders = capture;
   }
+  
+  public Map<String, String> getRequestHeaders() {
+    if (requestHeaders == null) requestHeaders = new HashMap<String,String>();
+    return requestHeaders;
+  }  
 }



Mime
View raw message