You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/04/29 23:59:14 UTC
svn commit: r398246 -
/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Author: sebb
Date: Sat Apr 29 14:59:13 2006
New Revision: 398246
URL: http://svn.apache.org/viewcvs?rev=398246&view=rev
Log:
Add the PUT content
Modified:
jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Modified: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?rev=398246&r1=398245&r2=398246&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java Sat Apr 29 14:59:13 2006
@@ -51,6 +51,7 @@
import org.apache.commons.httpclient.methods.OptionsMethod;
import org.apache.commons.httpclient.methods.PostMethod;
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;
import org.apache.commons.httpclient.protocol.Protocol;
@@ -571,7 +572,9 @@
if (method.equals(POST)) {
res.setQueryString(getQueryString());
sendPostData(httpMethod);
- }
+ }else if (method.equals(PUT)) {
+ setPutHeaders((PutMethod) httpMethod);
+ }
int statusCode = client.executeMethod(httpMethod);
@@ -659,7 +662,22 @@
}
}
- /**
+ /**
+ * Set up the PUT data (if present)
+ */
+ private void setPutHeaders(PutMethod put)
+ throws IOException
+ {
+ String filename = getFilename();
+ if ((filename != null) && (filename.trim().length() > 0))
+ {
+ RequestEntity requestEntity = new InputStreamRequestEntity(
+ new FileInputStream(filename),getMimetype());
+ put.setRequestEntity(requestEntity);
+ }
+ }
+
+ /**
* From the <code>HttpState</code>, store all the "set-cookie" key-pair
* values in the cookieManager of the <code>UrlConfig</code>.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org