abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r603281 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client: RequestOptions.java util/MethodHelper.java
Date Tue, 11 Dec 2007 15:55:29 GMT
Author: jmsnell
Date: Tue Dec 11 07:55:28 2007
New Revision: 603281

URL: http://svn.apache.org/viewvc?rev=603281&view=rev
Log:
Add a method to enable/disable automatic redirect following per the conversation on the user
mailing list

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?rev=603281&r1=603280&r2=603281&view=diff
==============================================================================
--- 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
Tue Dec 11 07:55:28 2007
@@ -49,6 +49,7 @@
   private boolean requestException5xx = false;
   private boolean useExpectContinue = true;
   private boolean useConditional = true;
+  private boolean followRedirects = true;
   
   private final Map<String,String[]> headers = new HashMap<String,String[]>();
 
   
@@ -557,6 +558,21 @@
    */
   public RequestOptions setConditionalPut(boolean conditional) {
     this.useConditional = conditional;
+    return this;
+  }
+  
+  /**
+   * True if the client should follow redirects automatically
+   */
+  public boolean isFollowRedirects() {
+    return followRedirects;
+  }
+  
+  /**
+   * True if the client should follow redirects automatically
+   */
+  public RequestOptions setFollowRedirects(boolean followredirects) {
+    this.followRedirects = followredirects;
     return this;
   }
 }

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?rev=603281&r1=603280&r2=603281&view=diff
==============================================================================
--- 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
Tue Dec 11 07:55:28 2007
@@ -155,6 +155,9 @@
         httpMethod.getParams().setBooleanParameter(
           HttpMethodParams.USE_EXPECT_CONTINUE, false);
       
+      // should we follow redirects, default is true
+      httpMethod.setFollowRedirects(options.isFollowRedirects());
+      
       return httpMethod;
   }
 



Mime
View raw message