abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555761 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client: RequestOptions.java util/MethodHelper.java
Date Thu, 12 Jul 2007 21:02:25 GMT
Author: jmsnell
Date: Thu Jul 12 14:02:24 2007
New Revision: 555761

URL: http://svn.apache.org/viewvc?view=rev&rev=555761
Log:
New RequestOption to disable the use of Expect-Continue for individual requests

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?view=diff&rev=555761&r1=555760&r2=555761
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
Thu Jul 12 14:02:24 2007
@@ -45,6 +45,7 @@
   private boolean usePostOverride = false;
   private boolean requestException4xx = false;
   private boolean requestException5xx = false;
+  private boolean useExpectContinue = true;
   
   private final Map<String,List<String>> headers;  
   
@@ -480,5 +481,20 @@
    */
   public boolean is5xxRequestException() {
     return this.requestException5xx;
+  }
+  
+  /**
+   * Set whether or not to use the HTTP Expect-Continue mechanism
+   * (enabled by default)
+   */
+  public void setUseExpectContinue(boolean useExpect) {
+    this.useExpectContinue = useExpect;
+  }
+  
+  /**
+   * Return true if Expect-Continue should be used
+   */
+  public boolean isUseExpectContinue() {
+    return this.useExpectContinue;
   }
 }

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java?view=diff&rev=555761&r1=555760&r2=555761
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/MethodHelper.java
Thu Jul 12 14:02:24 2007
@@ -34,6 +34,7 @@
 import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.httpclient.methods.TraceMethod;
+import org.apache.commons.httpclient.params.HttpMethodParams;
 
 public class MethodHelper {
 
@@ -148,6 +149,13 @@
         httpMethod.addRequestHeader("X-HTTP-Method-Override", actual.name());
       }
       initHeaders(options, httpMethod);
+      
+      // by default use expect-continue is enabled on the client
+      // only disable if explicitly disabled
+      if (!options.isUseExpectContinue())
+        httpMethod.getParams().setBooleanParameter(
+          HttpMethodParams.USE_EXPECT_CONTINUE, false);
+      
       return httpMethod;
   }
 



Mime
View raw message