sebb 2003/10/05 05:24:08
Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
HTTPSampler.java
Log:
Bug 19004 - allow redirects to be delegated to URLConnection
Revision Changes Path
1.54 +17 -2
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
Index: HTTPSampler.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- HTTPSampler.java 5 Oct 2003 01:23:05 -0000 1.53
+++ HTTPSampler.java 5 Oct 2003 12:24:08 -0000 1.54
@@ -166,6 +166,17 @@
private static Substitution spaceSub = new StringSubstitution("%20");
private int connectionTries = 0;
+
+ /* Delegate redirects to the URLConnection implementation - this can be useful
+ * with alternate URLConnection implementations.
+ *
+ * Defaults to false, to maintain backward compatibility.
+ */
+ private static boolean delegateRedirects =
+ JMeterUtils.getJMeterProperties().
+ getProperty("HTTPSampler.delegateRedirects","false").equalsIgnoreCase("true") ;
+
+
public void setFileField(String value)
{
setProperty(FILE_FIELD, value);
@@ -627,7 +638,11 @@
// My longer term plan is to use Apache's home grown HTTP Client, or
// maybe even HTTPUnit's classes. I'm sure both would be better than
// Sun's.
- HttpURLConnection.setFollowRedirects(false);
+
+ // [sebb] Make redirect following configurable (see bug 19004)
+ // They do seem to work on JVM 1.4.1_03 (Sun/WinXP)
+ HttpURLConnection.setFollowRedirects(delegateRedirects);
+
conn = (HttpURLConnection) u.openConnection();
// Delegate SSL specific stuff to SSLManager so that compilation still
// works otherwise.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]