Author: sebb
Date: Sun Oct 21 08:50:15 2007
New Revision: 586911
URL: http://svn.apache.org/viewvc?rev=586911&view=rev
Log:
Use HTTPConstants instead of HTTPSamplerBase
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
Sun Oct 21 08:50:15 2007
@@ -35,6 +35,7 @@
import org.apache.jmeter.protocol.http.parser.HtmlParsingUtils;
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testelement.AbstractTestElement;
@@ -101,7 +102,7 @@
}
sampler.setDomain(url.getDomain());
sampler.setPath(url.getPath());
- if (url.getMethod().equals(HTTPSamplerBase.POST)) {
+ if (url.getMethod().equals(HTTPConstants.POST)) {
PropertyIterator iter =
sampler.getArguments().iterator();
while (iter.hasNext()) {
Argument arg = (Argument)
iter.next().getObjectValue();
@@ -160,7 +161,7 @@
Iterator iter = urls.iterator();
while (iter.hasNext()) {
HTTPSamplerBase newUrl = (HTTPSamplerBase) iter.next();
- newUrl.setMethod(HTTPSamplerBase.POST);
+ newUrl.setMethod(HTTPConstants.POST);
if (log.isDebugEnabled()) {
log.debug("Potential Form match: " +
newUrl.toString());
}
@@ -191,7 +192,7 @@
}
try {
HTTPSamplerBase newUrl =
HtmlParsingUtils.createUrlFromAnchor(hrefStr, new URL(result.getURL(), base));
- newUrl.setMethod(HTTPSamplerBase.GET);
+ newUrl.setMethod(HTTPConstants.GET);
if (log.isDebugEnabled()) {
log.debug("Potential <a href> match: " +
newUrl);
}
@@ -224,7 +225,7 @@
try {
HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(
hrefStr, new URL(result.getURL(), base));
- newUrl.setMethod(HTTPSamplerBase.GET);
+ newUrl.setMethod(HTTPConstants.GET);
if (log.isDebugEnabled()) {
log.debug("Potential <frame src> match: " + newUrl);
}
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
Sun Oct 21 08:50:15 2007
@@ -39,6 +39,7 @@
import org.apache.jmeter.protocol.http.sampler.HTTPSampler2;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.logging.LoggingManager;
@@ -273,7 +274,7 @@
}
private boolean isMultipart(String contentType) {
- if (contentType != null &&
contentType.startsWith(HTTPSamplerBase.MULTIPART_FORM_DATA)) {
+ if (contentType != null &&
contentType.startsWith(HTTPConstants.MULTIPART_FORM_DATA)) {
return true;
} else {
return false;
@@ -306,7 +307,7 @@
if (log.isDebugEnabled())
log.debug("Proxy: setting protocol to : " + protocol);
sampler.setProtocol(protocol);
- } else if (sampler.getPort() ==
HTTPSamplerBase.DEFAULT_HTTPS_PORT) {
+ } else if (sampler.getPort() ==
HTTPConstants.DEFAULT_HTTPS_PORT) {
sampler.setProtocol(HTTPS);
if (log.isDebugEnabled())
log.debug("Proxy: setting protocol to https");
@@ -395,7 +396,7 @@
// If it was a HTTP GET request, then all parameters in the URL
// has been handled by the sampler.setPath above, so we just need
// to do parse the rest of the request if it is not a GET request
- if(!HTTPSamplerBase.GET.equals(method)) {
+ if(!HTTPConstants.GET.equals(method)) {
// Check if it was a multipart http post request
final String contentType = getContentType();
MultipartUrlConfig urlConfig = getMultipartConfig(contentType);
@@ -418,10 +419,10 @@
sampler.setMimetype(urlConfig.getMimeType());
} else if (postData != null && postData.trim().startsWith("<?")) {
// Not sure if this is needed anymore. I assume these requests
- // do not have
HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED as content type,
+ // do not have HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED
as content type,
// and they would therefore be catched by the last else if of
these if else if tests
sampler.addNonEncodedArgument("", postData, ""); //used when
postData is pure xml (ex. an xml-rpc call)
- } else if (contentType == null ||
contentType.startsWith(HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED) ){
+ } else if (contentType == null ||
contentType.startsWith(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED) ){
// It is the most common post request, with parameter name and
values
// We also assume this if no content type is present, to be
most backwards compatible,
// but maybe we should only parse arguments if the content
type is as expected
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
Sun Oct 21 08:50:15 2007
@@ -32,6 +32,7 @@
import org.apache.jmeter.protocol.http.parser.HTMLParseException;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.logging.LoggingManager;
@@ -249,26 +250,26 @@
String line=headerLines[i];
String[] parts=line.split(":\\s+",2); // $NON-NLS-1$
if (parts.length==2){
- if
(HTTPSamplerBase.TRANSFER_ENCODING.equalsIgnoreCase(parts[0])){
+ if
(HTTPConstants.TRANSFER_ENCODING.equalsIgnoreCase(parts[0])){
headerLines[i]=null; // We don't want
this passed on to browser
continue;
}
- if
(HTTPSamplerBase.HEADER_CONTENT_ENCODING.equalsIgnoreCase(parts[0])
+ if
(HTTPConstants.HEADER_CONTENT_ENCODING.equalsIgnoreCase(parts[0])
&&
-
HTTPSamplerBase.ENCODING_GZIP.equalsIgnoreCase(parts[1])
+
HTTPConstants.ENCODING_GZIP.equalsIgnoreCase(parts[1])
){
headerLines[i]=null; // We don't want
this passed on to browser
fixContentLength = true;
continue;
}
- if
(HTTPSamplerBase.HEADER_CONTENT_LENGTH.equalsIgnoreCase(parts[0])){
+ if
(HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(parts[0])){
contentLengthIndex=i;
continue;
}
}
}
if (fixContentLength && contentLengthIndex>=0){// Fix the
content length
-
headerLines[contentLengthIndex]=HTTPSamplerBase.HEADER_CONTENT_LENGTH+":
"+res.getResponseData().length;
+
headerLines[contentLengthIndex]=HTTPConstants.HEADER_CONTENT_LENGTH+":
"+res.getResponseData().length;
}
StringBuffer sb = new StringBuffer(headers.length());
for (int i=0;i<headerLines.length;i++){
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
Sun Oct 21 08:50:15 2007
@@ -20,6 +20,7 @@
import java.net.URL;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.samplers.SampleResult;
/**
@@ -106,7 +107,7 @@
sb.append(u.toString());
sb.append("\n");
// Include request body if it is a post or put
- if (HTTPSamplerBase.POST.equals(method) ||
HTTPSamplerBase.PUT.equals(method)) {
+ if (HTTPConstants.POST.equals(method) ||
HTTPConstants.PUT.equals(method)) {
sb.append("\nPOST data:\n");
sb.append(queryString);
sb.append("\n");
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
Sun Oct 21 08:50:15 2007
@@ -29,6 +29,7 @@
import java.net.URLConnection;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.testelement.property.PropertyIterator;
/**
@@ -163,8 +164,8 @@
if(sampler.getUseMultipartForPost()) {
// Set the content type
connection.setRequestProperty(
- HTTPSamplerBase.HEADER_CONTENT_TYPE,
- HTTPSamplerBase.MULTIPART_FORM_DATA + "; boundary=" +
getBoundary()); // $NON-NLS-1$
+ HTTPConstants.HEADER_CONTENT_TYPE,
+ HTTPConstants.MULTIPART_FORM_DATA + "; boundary=" +
getBoundary()); // $NON-NLS-1$
// Write the form section
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -217,7 +218,7 @@
contentLength += getMultipartEndDivider().length;
// Set the content length
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
+ connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
// Make the connection ready for sending post data
connection.setDoOutput(true);
@@ -226,7 +227,7 @@
else {
// Check if the header manager had a content type header
// This allows the user to specify his own content-type for a POST
request
- String contentTypeHeader =
connection.getRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE);
+ String contentTypeHeader =
connection.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE);
boolean hasContentTypeHeader = contentTypeHeader != null &&
contentTypeHeader.length() > 0;
// If there are no arguments, we can send a file as the body of
the request
@@ -234,10 +235,10 @@
if(!hasContentTypeHeader) {
// Allow the mimetype of the file to control the content
type
if(sampler.getMimetype() != null &&
sampler.getMimetype().length() > 0) {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
sampler.getMimetype());
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
sampler.getMimetype());
}
else {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED);
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
}
}
@@ -255,7 +256,7 @@
if(!sampler.getSendParameterValuesAsPostBody()) {
// Set the content type
if(!hasContentTypeHeader) {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED);
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
}
// It is a normal post request, with parameter names and
values
@@ -267,11 +268,11 @@
// but just sending the content of nameless parameters
if(!hasContentTypeHeader) {
if(sampler.getMimetype() != null &&
sampler.getMimetype().length() > 0) {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
sampler.getMimetype());
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
sampler.getMimetype());
}
else {
// TODO: is this the correct default?
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED);
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
}
}
@@ -296,7 +297,7 @@
}
// Set the content length
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
+ connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
// Make the connection ready for sending post data
connection.setDoOutput(true);
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java?rev=586911&r1=586910&r2=586911&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java
Sun Oct 21 08:50:15 2007
@@ -24,6 +24,7 @@
import java.net.URLConnection;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.testelement.property.PropertyIterator;
/**
@@ -50,7 +51,7 @@
// Check if the header manager had a content type header
// This allows the user to specify his own content-type for a PUT
request
- String contentTypeHeader =
connection.getRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE);
+ String contentTypeHeader =
connection.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE);
boolean hasContentTypeHeader = contentTypeHeader != null &&
contentTypeHeader.length() > 0;
// If there are no arguments, we can send a file as the body of the
request
@@ -59,7 +60,7 @@
if(!hasContentTypeHeader) {
// Allow the mimetype of the file to control the content type
if(sampler.getMimetype() != null &&
sampler.getMimetype().length() > 0) {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
sampler.getMimetype());
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
sampler.getMimetype());
}
}
@@ -73,7 +74,7 @@
// This is not obvious in GUI if you are not uploading any files,
// but just sending the content of nameless parameters
if(!hasContentTypeHeader && sampler.getMimetype() != null &&
sampler.getMimetype().length() > 0) {
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_TYPE,
sampler.getMimetype());
+
connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,
sampler.getMimetype());
}
// We create the post body content now, so we know the size
@@ -99,7 +100,7 @@
}
if(hasPutBody) {
// Set the content length
-
connection.setRequestProperty(HTTPSamplerBase.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
+ connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_LENGTH,
Long.toString(contentLength));
// Make the connection ready for sending post data
connection.setDoOutput(true);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]