You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2012/06/23 17:36:20 UTC

svn commit: r1353149 [1/2] - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http: control/ control/gui/ modifier/ proxy/ sampler/

Author: sebb
Date: Sat Jun 23 15:36:18 2012
New Revision: 1353149

URL: http://svn.apache.org/viewvc?rev=1353149&view=rev
Log:
Standardise on HTTPConstants, not the interface

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPFileImpl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PutWriter.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java Sat Jun 23 15:36:18 2012
@@ -34,7 +34,7 @@ import java.util.StringTokenizer;
 import org.apache.commons.io.IOUtils;
 import org.apache.jmeter.config.ConfigElement;
 import org.apache.jmeter.config.ConfigTestElement;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.testelement.property.CollectionProperty;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.testelement.property.TestElementProperty;
@@ -289,6 +289,6 @@ public class AuthManager extends ConfigT
     // Needs to be package protected for Unit test
     static boolean isSupportedProtocol(URL url) {
         String protocol = url.getProtocol().toLowerCase(java.util.Locale.ENGLISH);
-        return protocol.equals(HTTPConstantsInterface.PROTOCOL_HTTP) || protocol.equals(HTTPConstantsInterface.PROTOCOL_HTTPS);
+        return protocol.equals(HTTPConstants.PROTOCOL_HTTP) || protocol.equals(HTTPConstants.PROTOCOL_HTTPS);
     }
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java Sat Jun 23 15:36:18 2012
@@ -37,7 +37,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.jmeter.config.ConfigTestElement;
 import org.apache.jmeter.engine.event.LoopIterationEvent;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.TestListener;
 import org.apache.jmeter.testelement.property.BooleanProperty;
@@ -109,11 +109,11 @@ public class CacheManager extends Config
      */
     public void saveDetails(URLConnection conn, SampleResult res){
         if (isCacheable(res)){
-            String lastModified = conn.getHeaderField(HTTPConstantsInterface.LAST_MODIFIED);
-            String expires = conn.getHeaderField(HTTPConstantsInterface.EXPIRES);
-            String etag = conn.getHeaderField(HTTPConstantsInterface.ETAG);
+            String lastModified = conn.getHeaderField(HTTPConstants.LAST_MODIFIED);
+            String expires = conn.getHeaderField(HTTPConstants.EXPIRES);
+            String etag = conn.getHeaderField(HTTPConstants.ETAG);
             String url = conn.getURL().toString();
-            String cacheControl = conn.getHeaderField(HTTPConstantsInterface.CACHE_CONTROL);
+            String cacheControl = conn.getHeaderField(HTTPConstants.CACHE_CONTROL);
             setCache(lastModified, cacheControl, expires, etag, url);
         }
     }
@@ -126,11 +126,11 @@ public class CacheManager extends Config
      */
     public void saveDetails(HttpMethod method, SampleResult res) throws URIException{
         if (isCacheable(res)){
-            String lastModified = getHeader(method ,HTTPConstantsInterface.LAST_MODIFIED);
-            String expires = getHeader(method ,HTTPConstantsInterface.EXPIRES);
-            String etag = getHeader(method ,HTTPConstantsInterface.ETAG);
+            String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED);
+            String expires = getHeader(method ,HTTPConstants.EXPIRES);
+            String etag = getHeader(method ,HTTPConstants.ETAG);
             String url = method.getURI().toString();
-            String cacheControl = getHeader(method, HTTPConstantsInterface.CACHE_CONTROL);
+            String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL);
             setCache(lastModified, cacheControl, expires, etag, url);
         }
     }
@@ -144,10 +144,10 @@ public class CacheManager extends Config
     public void saveDetails(HttpResponse method, SampleResult res) {
         if (isCacheable(res)){
             method.getLastHeader(USE_EXPIRES);
-            String lastModified = getHeader(method ,HTTPConstantsInterface.LAST_MODIFIED);
-            String expires = getHeader(method ,HTTPConstantsInterface.EXPIRES);
-            String etag = getHeader(method ,HTTPConstantsInterface.ETAG);
-            String cacheControl = getHeader(method, HTTPConstantsInterface.CACHE_CONTROL);
+            String lastModified = getHeader(method ,HTTPConstants.LAST_MODIFIED);
+            String expires = getHeader(method ,HTTPConstants.EXPIRES);
+            String etag = getHeader(method ,HTTPConstants.ETAG);
+            String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL);
             setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString()); // TODO correct URL?
         }
     }
@@ -219,11 +219,11 @@ public class CacheManager extends Config
         if (entry != null){
             final String lastModified = entry.getLastModified();
             if (lastModified != null){
-                method.setRequestHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
+                method.setRequestHeader(HTTPConstants.IF_MODIFIED_SINCE, lastModified);
             }
             final String etag = entry.getEtag();
             if (etag != null){
-                method.setRequestHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
+                method.setRequestHeader(HTTPConstants.IF_NONE_MATCH, etag);
             }
         }
     }
@@ -244,11 +244,11 @@ public class CacheManager extends Config
         if (entry != null){
             final String lastModified = entry.getLastModified();
             if (lastModified != null){
-                request.setHeader(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
+                request.setHeader(HTTPConstants.IF_MODIFIED_SINCE, lastModified);
             }
             final String etag = entry.getEtag();
             if (etag != null){
-                request.setHeader(HTTPConstantsInterface.IF_NONE_MATCH, etag);
+                request.setHeader(HTTPConstants.IF_NONE_MATCH, etag);
             }
         }
     }
@@ -268,11 +268,11 @@ public class CacheManager extends Config
         if (entry != null){
             final String lastModified = entry.getLastModified();
             if (lastModified != null){
-                conn.addRequestProperty(HTTPConstantsInterface.IF_MODIFIED_SINCE, lastModified);
+                conn.addRequestProperty(HTTPConstants.IF_MODIFIED_SINCE, lastModified);
             }
             final String etag = entry.getEtag();
             if (etag != null){
-                conn.addRequestProperty(HTTPConstantsInterface.IF_NONE_MATCH, etag);
+                conn.addRequestProperty(HTTPConstants.IF_NONE_MATCH, etag);
             }
         }
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java Sat Jun 23 15:36:18 2012
@@ -43,7 +43,7 @@ import org.apache.jmeter.gui.util.Horizo
 import org.apache.jmeter.protocol.http.control.AuthManager;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.WSDLHelper;
 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
 import org.apache.jmeter.testelement.TestElement;
@@ -171,7 +171,7 @@ public class WebServiceSamplerGui extend
         sampler.setProtocol(protocol.getText());
         sampler.setPath(path.getText());
         sampler.setWsdlURL(wsdlField.getText());
-        sampler.setMethod(HTTPConstantsInterface.POST);
+        sampler.setMethod(HTTPConstants.POST);
         sampler.setSoapAction(soapAction.getText());
         sampler.setMaintainSession(maintainSession.isSelected());
         sampler.setXmlData(soapXml.getText());

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java Sat Jun 23 15:36:18 2012
@@ -33,7 +33,7 @@ import org.apache.jmeter.protocol.http.p
 import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.util.ConversionUtils;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+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;
@@ -96,7 +96,7 @@ public class AnchorModifier extends Abst
             }
             sampler.setDomain(url.getDomain());
             sampler.setPath(url.getPath());
-            if (url.getMethod().equals(HTTPConstantsInterface.POST)) {
+            if (url.getMethod().equals(HTTPConstants.POST)) {
                 PropertyIterator iter = sampler.getArguments().iterator();
                 while (iter.hasNext()) {
                     Argument arg = (Argument) iter.next().getObjectValue();
@@ -154,7 +154,7 @@ public class AnchorModifier extends Abst
             urls.addAll(HtmlParsingUtils.createURLFromForm(rootList.item(x), result.getURL()));
         }
         for (HTTPSamplerBase newUrl : urls) {
-            newUrl.setMethod(HTTPConstantsInterface.POST);
+            newUrl.setMethod(HTTPConstants.POST);
             if (log.isDebugEnabled()) {
                 log.debug("Potential Form match: " + newUrl.toString());
             }
@@ -186,7 +186,7 @@ public class AnchorModifier extends Abst
             }
             try {
                 HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(hrefStr, ConversionUtils.makeRelativeURL(result.getURL(), base));
-                newUrl.setMethod(HTTPConstantsInterface.GET);
+                newUrl.setMethod(HTTPConstants.GET);
                 if (log.isDebugEnabled()) {
                     log.debug("Potential <a href> match: " + newUrl);
                 }
@@ -220,7 +220,7 @@ public class AnchorModifier extends Abst
            try {
                HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor(
                        hrefStr, ConversionUtils.makeRelativeURL(result.getURL(), base));
-               newUrl.setMethod(HTTPConstantsInterface.GET);
+               newUrl.setMethod(HTTPConstants.GET);
                if (log.isDebugEnabled()) {
                    log.debug("Potential <frame src> match: " + newUrl);
                }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java Sat Jun 23 15:36:18 2012
@@ -32,7 +32,7 @@ import org.apache.jmeter.protocol.http.s
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
 import org.apache.jmeter.protocol.http.sampler.PostWriter;
 import org.apache.jmeter.protocol.http.util.ConversionUtils;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jorphan.logging.LoggingManager;
@@ -130,7 +130,7 @@ public class DefaultSamplerCreator exten
         // 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((!HTTPConstantsInterface.CONNECT.equals(request.getMethod())) && (!HTTPConstantsInterface.GET.equals(request.getMethod()))) {
+        if((!HTTPConstants.CONNECT.equals(request.getMethod())) && (!HTTPConstants.GET.equals(request.getMethod()))) {
             // Check if it was a multipart http post request
             final String contentType = request.getContentType();
             MultipartUrlConfig urlConfig = request.getMultipartConfig(contentType);
@@ -172,7 +172,7 @@ public class DefaultSamplerCreator exten
             // used when postData is pure xml (eg. an xml-rpc call) or for PUT
             } else if (postData.trim().startsWith("<?") || "PUT".equals(sampler.getMethod())) {
                 sampler.addNonEncodedArgument("", postData, "");
-            } else if (contentType == null || contentType.startsWith(HTTPConstantsInterface.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
@@ -203,7 +203,7 @@ public class DefaultSamplerCreator exten
      */
     protected void computeSamplerName(HTTPSamplerBase sampler,
             HttpRequestHdr request) {
-        if (!HTTPConstantsInterface.CONNECT.equals(request.getMethod()) && isNumberRequests()) {
+        if (!HTTPConstants.CONNECT.equals(request.getMethod()) && isNumberRequests()) {
             incrementRequestNumber();
             sampler.setName(getRequestNumber() + " " + sampler.getPath());
         } else {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java Sat Jun 23 15:36:18 2012
@@ -32,7 +32,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.protocol.http.gui.HeaderPanel;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+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;
@@ -161,7 +161,7 @@ public class HttpRequestHdr {
             log.debug("parsed version:" + version);
         }
         // SSL connection
-        if (getMethod().startsWith(HTTPConstantsInterface.CONNECT)) {
+        if (getMethod().startsWith(HTTPConstants.CONNECT)) {
             paramHttps = url;
         }
         if (url.startsWith("/")) {
@@ -193,7 +193,7 @@ public class HttpRequestHdr {
         for (String key : headers.keySet()) {
             if (!key.equals(PROXY_CONNECTION)
              && !key.equals(CONTENT_LENGTH)
-             && !key.equalsIgnoreCase(HTTPConstantsInterface.HEADER_CONNECTION)) {
+             && !key.equalsIgnoreCase(HTTPConstants.HEADER_CONNECTION)) {
                 manager.add(headers.get(key));
             }
         }
@@ -219,7 +219,7 @@ public class HttpRequestHdr {
     }
 
     private boolean isMultipart(String contentType) {
-        if (contentType != null && contentType.startsWith(HTTPConstantsInterface.MULTIPART_FORM_DATA)) {
+        if (contentType != null && contentType.startsWith(HTTPConstants.MULTIPART_FORM_DATA)) {
             return true;
         }
         return false;
@@ -399,7 +399,7 @@ public class HttpRequestHdr {
                 log.debug("Proxy: setting protocol to : " + protocol);
             }
             return protocol;
-        } else if (sampler.getPort() == HTTPConstantsInterface.DEFAULT_HTTPS_PORT) {
+        } else if (sampler.getPort() == HTTPConstants.DEFAULT_HTTPS_PORT) {
             if (log.isDebugEnabled()) {
                 log.debug("Proxy: setting protocol to https");
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sat Jun 23 15:36:18 2012
@@ -50,7 +50,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.parser.HTMLParseException;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.util.ConversionUtils;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
@@ -190,7 +190,7 @@ public class Proxy extends Thread {
             request.parse(new BufferedInputStream(clientSocket.getInputStream()));
             outStreamClient = clientSocket.getOutputStream();
 
-            if ((request.getMethod().startsWith(HTTPConstantsInterface.CONNECT)) && (outStreamClient != null)) {
+            if ((request.getMethod().startsWith(HTTPConstants.CONNECT)) && (outStreamClient != null)) {
                 log.debug("Method CONNECT => SSL");
                 // write a OK reponse to browser, to engage SSL exchange
                 outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$
@@ -226,11 +226,11 @@ public class Proxy extends Thread {
                 if (httpsSpoofMatch.length() > 0){
                     String url = request.getUrl();
                     if (url.matches(httpsSpoofMatch)){
-                        sampler.setProtocol(HTTPConstantsInterface.PROTOCOL_HTTPS);
+                        sampler.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
                         forcedHTTPS = true;
                     }
                 } else {
-                    sampler.setProtocol(HTTPConstantsInterface.PROTOCOL_HTTPS);
+                    sampler.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
                     forcedHTTPS = true;
                 }
             }
@@ -247,7 +247,7 @@ public class Proxy extends Thread {
                 final String enc = result.getDataEncodingWithDefault();
                 String noHttpsResult = new String(result.getResponseData(),enc);
                 final String HTTPS_HOST = // match https://host[:port]/ and drop default port if present
-                    "https://([^:/]+)(:"+HTTPConstantsInterface.DEFAULT_HTTPS_PORT_STRING+")?"; // $NON-NLS-1$ $NON-NLS-2$
+                    "https://([^:/]+)(:"+HTTPConstants.DEFAULT_HTTPS_PORT_STRING+")?"; // $NON-NLS-1$ $NON-NLS-2$
                 noHttpsResult = noHttpsResult.replaceAll(HTTPS_HOST, "http://$1"); // $NON-NLS-1$
                 result.setResponseData(noHttpsResult.getBytes(enc));
             }
@@ -291,8 +291,8 @@ public class Proxy extends Thread {
              * We don't want to store any cookies in the generated test plan
              */
             if (headers != null) {
-                headers.removeHeaderNamed(HTTPConstantsInterface.HEADER_COOKIE);// Always remove cookies
-                headers.removeHeaderNamed(HTTPConstantsInterface.HEADER_AUTHORIZATION);// Always remove authorization
+                headers.removeHeaderNamed(HTTPConstants.HEADER_COOKIE);// Always remove cookies
+                headers.removeHeaderNamed(HTTPConstants.HEADER_AUTHORIZATION);// Always remove authorization
                 // Remove additional headers
                 for(String hdr : headersToRemove){
                     headers.removeHeaderNamed(hdr);
@@ -477,36 +477,36 @@ public class Proxy extends Thread {
             String line=headerLines[i];
             String[] parts=line.split(":\\s+",2); // $NON-NLS-1$
             if (parts.length==2){
-                if (HTTPConstantsInterface.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 (HTTPConstantsInterface.HEADER_CONTENT_ENCODING.equalsIgnoreCase(parts[0])
+                if (HTTPConstants.HEADER_CONTENT_ENCODING.equalsIgnoreCase(parts[0])
                     &&
-                    HTTPConstantsInterface.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 (HTTPConstantsInterface.HEADER_CONTENT_LENGTH.equalsIgnoreCase(parts[0])){
+                if (HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(parts[0])){
                     contentLengthIndex=i;
                     continue;
                 }
                 final String HTTPS_PREFIX = "https://";
-                if (forcedHTTPS && HTTPConstantsInterface.HEADER_LOCATION.equalsIgnoreCase(parts[0])
+                if (forcedHTTPS && HTTPConstants.HEADER_LOCATION.equalsIgnoreCase(parts[0])
                         && parts[1].substring(0, HTTPS_PREFIX.length()).equalsIgnoreCase(HTTPS_PREFIX)){
                     headerLines[i]=headerLines[i].replaceFirst(parts[1].substring(0,HTTPS_PREFIX.length()), "http://");
                     continue;
                 }
-                if (forcedHTTPS && (HTTPConstantsInterface.HEADER_COOKIE.equalsIgnoreCase(parts[0]) || HTTPConstantsInterface.HEADER_SET_COOKIE.equalsIgnoreCase(parts[0])))
+                if (forcedHTTPS && (HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(parts[0]) || HTTPConstants.HEADER_SET_COOKIE.equalsIgnoreCase(parts[0])))
                 {
                     headerLines[i]=COOKIE_SECURE_PATTERN.matcher(headerLines[i]).replaceAll("").trim(); //in forced https cookies need to be unsecured...
                 }
             }
         }
         if (fixContentLength && contentLengthIndex>=0){// Fix the content length
-            headerLines[contentLengthIndex]=HTTPConstantsInterface.HEADER_CONTENT_LENGTH+": "+res.getResponseData().length;
+            headerLines[contentLengthIndex]=HTTPConstants.HEADER_CONTENT_LENGTH+": "+res.getResponseData().length;
         }
         StringBuilder sb = new StringBuilder(headers.length());
         for (int i=0;i<headerLines.length;i++){

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java Sat Jun 23 15:36:18 2012
@@ -31,6 +31,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.CookieManager;
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.samplers.Interruptible;
 import org.apache.jmeter.testelement.property.CollectionProperty;
@@ -168,7 +169,7 @@ public class AjpSampler extends HTTPSamp
         res.setHTTPMethod(method);
         outpos = 4;
         setByte((byte)2);
-        if(method.equals(POST)) {
+        if(method.equals(HTTPConstants.POST)) {
             setByte((byte)4);
         } else {
             setByte((byte)2);
@@ -176,14 +177,14 @@ public class AjpSampler extends HTTPSamp
         if(JMeterUtils.getPropDefault("httpclient.version","1.1").equals("1.0")) {//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
             setString("HTTP/1.0");//$NON-NLS-1$
         } else {
-            setString(HTTP_1_1);
+            setString(HTTPConstants.HTTP_1_1);
         }
         setString(url.getPath());
         setString(localAddress);
         setString(localName);
         setString(host);
         setInt(url.getDefaultPort());
-        setByte(PROTOCOL_HTTPS.equalsIgnoreCase(scheme) ? (byte)1 : (byte)0);
+        setByte(HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(scheme) ? (byte)1 : (byte)0);
         setInt(getHeaderSize(method, url));
         String hdr = setConnectionHeaders(url, host, method);
         res.setRequestHeaders(hdr);
@@ -201,7 +202,7 @@ public class AjpSampler extends HTTPSamp
         CookieManager cookies = getCookieManager();
         AuthManager auth = getAuthManager();
         int hsz = 1; // Host always
-        if(method.equals(POST)) {
+        if(method.equals(HTTPConstants.POST)) {
             HTTPFileArg[] hfa = getHTTPFiles();
             if(hfa.length > 0) {
                 hsz += 3;
@@ -251,7 +252,7 @@ public class AjpSampler extends HTTPSamp
                 setString(v);
             }
         }
-        if(method.equals(POST)) {
+        if(method.equals(HTTPConstants.POST)) {
             int cl = -1;
             HTTPFileArg[] hfa = getHTTPFiles();
             if(hfa.length > 0) {
@@ -260,17 +261,17 @@ public class AjpSampler extends HTTPSamp
                 File input = new File(fn);
                 cl = (int)input.length();
                 body = new FileInputStream(input);
-                setString(HEADER_CONTENT_DISPOSITION);
+                setString(HTTPConstants.HEADER_CONTENT_DISPOSITION);
                 setString("form-data; name=\""+encode(fa.getParamName())+
                       "\"; filename=\"" + encode(fn) +"\""); //$NON-NLS-1$ //$NON-NLS-2$
                 String mt = fa.getMimeType();
-                hbuf.append(HEADER_CONTENT_TYPE).append(COLON_SPACE).append(mt).append(NEWLINE);
+                hbuf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(COLON_SPACE).append(mt).append(NEWLINE);
                 setInt(0xA007); // content-type
                 setString(mt);
             } else {
-                hbuf.append(HEADER_CONTENT_TYPE).append(COLON_SPACE).append(APPLICATION_X_WWW_FORM_URLENCODED).append(NEWLINE);
+                hbuf.append(HTTPConstants.HEADER_CONTENT_TYPE).append(COLON_SPACE).append(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED).append(NEWLINE);
                 setInt(0xA007); // content-type
-                setString(APPLICATION_X_WWW_FORM_URLENCODED);
+                setString(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                 StringBuilder sb = new StringBuilder();
                 boolean first = true;
                 PropertyIterator args = getArguments().iterator();
@@ -288,7 +289,7 @@ public class AjpSampler extends HTTPSamp
                 cl = sbody.length;
                 body = new ByteArrayInputStream(sbody);
             }
-            hbuf.append(HEADER_CONTENT_LENGTH).append(COLON_SPACE).append(String.valueOf(cl)).append(NEWLINE);
+            hbuf.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(COLON_SPACE).append(String.valueOf(cl)).append(NEWLINE);
             setInt(0xA008); // Content-length
             setString(String.valueOf(cl));
         }
@@ -297,7 +298,7 @@ public class AjpSampler extends HTTPSamp
             if(authHeader != null) {
                 setInt(0xA005); // Authorization
                 setString(authHeader);
-                hbuf.append(HEADER_AUTHORIZATION).append(COLON_SPACE).append(authHeader).append(NEWLINE);
+                hbuf.append(HTTPConstants.HEADER_AUTHORIZATION).append(COLON_SPACE).append(authHeader).append(NEWLINE);
             }
         }
         return hbuf.toString();
@@ -378,7 +379,7 @@ public class AjpSampler extends HTTPSamp
     private void execute(String method, HTTPSampleResult res)
     throws IOException {
         send();
-        if(method.equals(POST)) {
+        if(method.equals(HTTPConstants.POST)) {
             res.setQueryString(stringBody);
             sendPostBody();
         }
@@ -434,7 +435,7 @@ public class AjpSampler extends HTTPSamp
         res.setResponseMessage(msg);
         int nh = getInt();
         StringBuilder sb = new StringBuilder();
-        sb.append(HTTP_1_1 ).append(status).append(" ").append(msg).append(NEWLINE);//$NON-NLS-1$//$NON-NLS-2$
+        sb.append(HTTPConstants.HTTP_1_1 ).append(status).append(" ").append(msg).append(NEWLINE);//$NON-NLS-1$//$NON-NLS-2$
         for(int i=0; i < nh; i++) {
             String name;
             int thn = peekInt();
@@ -445,10 +446,10 @@ public class AjpSampler extends HTTPSamp
                 name = getString();
             }
             String value = getString();
-            if(HEADER_CONTENT_TYPE.equalsIgnoreCase(name)) {
+            if(HTTPConstants.HEADER_CONTENT_TYPE.equalsIgnoreCase(name)) {
                 res.setContentType(value);
                 res.setEncodingAndType(value);
-            } else if(HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
+            } else if(HTTPConstants.HEADER_SET_COOKIE.equalsIgnoreCase(name)) {
                 CookieManager cookies = getCookieManager();
                 if(cookies != null) {
                     cookies.addCookieFromHeader(value, res.getURL());

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPFileImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPFileImpl.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPFileImpl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPFileImpl.java Sat Jun 23 15:36:18 2012
@@ -25,6 +25,7 @@ import java.net.URL;
 import java.net.URLConnection;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 
 /**
  * HTTP Sampler which can read from file: URLs
@@ -44,7 +45,7 @@ public class HTTPFileImpl extends HTTPAb
             boolean areFollowingRedirect, int frameDepth) {
 
         HTTPSampleResult res = new HTTPSampleResult();
-        res.setHTTPMethod(GET); // Dummy
+        res.setHTTPMethod(HTTPConstants.GET); // Dummy
         res.setURL(url);
         res.setSampleLabel(url.toString());
         InputStream is = null;

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Sat Jun 23 15:36:18 2012
@@ -71,6 +71,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.protocol.http.util.EncoderCache;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.protocol.http.util.LoopbackHttpClientSocketFactory;
 import org.apache.jmeter.protocol.http.util.SlowHttpClientSocketFactory;
@@ -111,8 +112,8 @@ public class HTTPHC3Impl extends HTTPHCA
         log.info("HTTP request retry count = "+RETRY_COUNT);
         if (CPS_HTTP > 0) {
             log.info("Setting up HTTP SlowProtocol, cps="+CPS_HTTP);
-            Protocol.registerProtocol(PROTOCOL_HTTP,
-                    new Protocol(PROTOCOL_HTTP,new SlowHttpClientSocketFactory(CPS_HTTP),DEFAULT_HTTP_PORT));
+            Protocol.registerProtocol(HTTPConstants.PROTOCOL_HTTP,
+                    new Protocol(HTTPConstants.PROTOCOL_HTTP,new SlowHttpClientSocketFactory(CPS_HTTP),HTTPConstants.DEFAULT_HTTP_PORT));
         }
 
         // Now done in JsseSSLManager (which needs to register the protocol)
@@ -202,26 +203,26 @@ public class HTTPHC3Impl extends HTTPHCA
         res.sampleStart(); // Count the retries as well in the time
         try {
             // May generate IllegalArgumentException
-            if (method.equals(POST)) {
+            if (method.equals(HTTPConstants.POST)) {
                 httpMethod = new PostMethod(urlStr);
-            } else if (method.equals(PUT)){
+            } else if (method.equals(HTTPConstants.PUT)){
                 httpMethod = new PutMethod(urlStr);
-            } else if (method.equals(HEAD)){
+            } else if (method.equals(HTTPConstants.HEAD)){
                 httpMethod = new HeadMethod(urlStr);
-            } else if (method.equals(TRACE)){
+            } else if (method.equals(HTTPConstants.TRACE)){
                 httpMethod = new TraceMethod(urlStr);
-            } else if (method.equals(OPTIONS)){
+            } else if (method.equals(HTTPConstants.OPTIONS)){
                 httpMethod = new OptionsMethod(urlStr);
-            } else if (method.equals(DELETE)){
+            } else if (method.equals(HTTPConstants.DELETE)){
                 httpMethod = new DeleteMethod(urlStr);
-            } else if (method.equals(GET)){
+            } else if (method.equals(HTTPConstants.GET)){
                 httpMethod = new GetMethod(urlStr);
             } else {
                 throw new IllegalArgumentException("Unexpected method: "+method);
             }
 
             final CacheManager cacheManager = getCacheManager();
-            if (cacheManager != null && GET.equalsIgnoreCase(method)) {
+            if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
                if (cacheManager.inCache(url)) {
                    res.sampleEnd();
                    res.setResponseNoContent();
@@ -238,10 +239,10 @@ public class HTTPHC3Impl extends HTTPHCA
             savedClient = client;
 
             // Handle the various methods
-            if (method.equals(POST)) {
+            if (method.equals(HTTPConstants.POST)) {
                 String postBody = sendPostData((PostMethod)httpMethod);
                 res.setQueryString(postBody);
-            } else if (method.equals(PUT)) {
+            } else if (method.equals(HTTPConstants.PUT)) {
                 String putBody = sendPutData((PutMethod)httpMethod);
                 res.setQueryString(putBody);
             }
@@ -257,8 +258,8 @@ public class HTTPHC3Impl extends HTTPHCA
             if (instream != null) {// will be null for HEAD
                 instream = new CountingInputStream(instream);
                 try {
-                    Header responseHeader = httpMethod.getResponseHeader(HEADER_CONTENT_ENCODING);
-                    if (responseHeader!= null && ENCODING_GZIP.equals(responseHeader.getValue())) {
+                    Header responseHeader = httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
+                    if (responseHeader!= null && HTTPConstants.ENCODING_GZIP.equals(responseHeader.getValue())) {
                         InputStream tmpInput = new GZIPInputStream(instream); // tmp inputstream needs to have a good counting
                         res.setResponseData(readResponse(res, tmpInput, (int) httpMethod.getResponseContentLength()));                        
                     } else {
@@ -283,7 +284,7 @@ public class HTTPHC3Impl extends HTTPHCA
             res.setResponseMessage(httpMethod.getStatusText());
 
             String ct = null;
-            Header h = httpMethod.getResponseHeader(HEADER_CONTENT_TYPE);
+            Header h = httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             if (h != null)// Can be missing, e.g. on redirect
             {
                 ct = h.getValue();
@@ -293,7 +294,7 @@ public class HTTPHC3Impl extends HTTPHCA
 
             res.setResponseHeaders(getResponseHeaders(httpMethod));
             if (res.isRedirect()) {
-                final Header headerLocation = httpMethod.getResponseHeader(HEADER_LOCATION);
+                final Header headerLocation = httpMethod.getResponseHeader(HTTPConstants.HEADER_LOCATION);
                 if (headerLocation == null) { // HTTP protocol violation, but avoids NPE
                     throw new IllegalArgumentException("Missing location header");
                 }
@@ -384,10 +385,10 @@ public class HTTPHC3Impl extends HTTPHCA
 
         String schema = uri.getScheme();
         if ((schema == null) || (schema.length()==0)) {
-            schema = PROTOCOL_HTTP;
+            schema = HTTPConstants.PROTOCOL_HTTP;
         }
 
-        if (PROTOCOL_HTTPS.equalsIgnoreCase(schema)){
+        if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(schema)){
             SSLManager.getInstance(); // ensure the manager is initialised
             // we don't currently need to do anything further, as this sets the default https protocol
         }
@@ -497,9 +498,9 @@ public class HTTPHC3Impl extends HTTPHCA
         // leave it to the server to close the connection after their
         // timeout period. Leave it to the JMeter user to decide.
         if (getUseKeepAlive()) {
-            httpMethod.setRequestHeader(HEADER_CONNECTION, KEEP_ALIVE);
+            httpMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION, HTTPConstants.KEEP_ALIVE);
         } else {
-            httpMethod.setRequestHeader(HEADER_CONNECTION, CONNECTION_CLOSE);
+            httpMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION, HTTPConstants.CONNECTION_CLOSE);
         }
 
         setConnectionHeaders(httpMethod, u, getHeaderManager(), getCacheManager());
@@ -560,7 +561,7 @@ public class HTTPHC3Impl extends HTTPHCA
         if (cookieManager != null) {
             cookieHeader = cookieManager.getCookieHeaderForURL(u);
             if (cookieHeader != null) {
-                method.setRequestHeader(HEADER_COOKIE, cookieHeader);
+                method.setRequestHeader(HTTPConstants.HEADER_COOKIE, cookieHeader);
             }
         }
         return cookieHeader;
@@ -593,9 +594,9 @@ public class HTTPHC3Impl extends HTTPHCA
                     // Don't allow override of Content-Length
                     // This helps with SoapSampler hack too
                     // TODO - what other headers are not allowed?
-                    if (! HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
+                    if (! HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
                         String v = header.getValue();
-                        if (HEADER_HOST.equalsIgnoreCase(n)) {
+                        if (HTTPConstants.HEADER_HOST.equalsIgnoreCase(n)) {
                             v = v.replaceFirst(":\\d+$",""); // remove any port specification // $NON-NLS-1$ $NON-NLS-2$
                             method.getParams().setVirtualHost(v);
                         } else {
@@ -623,7 +624,7 @@ public class HTTPHC3Impl extends HTTPHCA
         Header[] requestHeaders = method.getRequestHeaders();
         for(int i = 0; i < requestHeaders.length; i++) {
             // Exclude the COOKIE header, since cookie is reported separately in the sample
-            if(!HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
+            if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
                 hdrs.append(requestHeaders[i].getName());
                 hdrs.append(": "); // $NON-NLS-1$
                 hdrs.append(requestHeaders[i].getValue());
@@ -748,7 +749,7 @@ public class HTTPHC3Impl extends HTTPHCA
 
             // Set the content type
             String multiPartContentType = multiPart.getContentType();
-            post.setRequestHeader(HEADER_CONTENT_TYPE, multiPartContentType);
+            post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, multiPartContentType);
 
             // If the Multipart is repeatable, we can send it first to
             // our own stream, without the actual file content, so we can return it
@@ -785,7 +786,7 @@ public class HTTPHC3Impl extends HTTPHCA
         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
-            Header contentTypeHeader = post.getRequestHeader(HEADER_CONTENT_TYPE);
+            Header contentTypeHeader = post.getRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             boolean hasContentTypeHeader = contentTypeHeader != null && contentTypeHeader.getValue() != null && contentTypeHeader.getValue().length() > 0;
             // If there are no arguments, we can send a file as the body of the request
             // TODO: needs a multiple file upload scenerio
@@ -795,10 +796,10 @@ public class HTTPHC3Impl extends HTTPHCA
                 if(!hasContentTypeHeader) {
                     // Allow the mimetype of the file to control the content type
                     if(file.getMimeType() != null && file.getMimeType().length() > 0) {
-                        post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                        post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                     }
                     else {
-                        post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                        post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
                 }
 
@@ -833,11 +834,11 @@ public class HTTPHC3Impl extends HTTPHCA
                     if(!hasContentTypeHeader) {
                         HTTPFileArg file = files.length > 0? files[0] : null;
                         if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
-                            post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                            post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                         }
                         else {
                              // TODO - is this the correct default?
-                            post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                            post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                         }
                     }
 
@@ -854,7 +855,7 @@ public class HTTPHC3Impl extends HTTPHCA
                         }
                         postBody.append(value);
                     }
-                    StringRequestEntity requestEntity = new StringRequestEntity(postBody.toString(), post.getRequestHeader(HEADER_CONTENT_TYPE).getValue(), contentEncoding);
+                    StringRequestEntity requestEntity = new StringRequestEntity(postBody.toString(), post.getRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE).getValue(), contentEncoding);
                     post.setRequestEntity(requestEntity);
                 }
                 else {
@@ -862,7 +863,7 @@ public class HTTPHC3Impl extends HTTPHCA
 
                     // Set the content type
                     if(!hasContentTypeHeader) {
-                        post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                        post.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
                     // Add the parameters
                     PropertyIterator args = getArguments().iterator();
@@ -924,7 +925,7 @@ public class HTTPHC3Impl extends HTTPHCA
             }
         }
         // Set the content length
-        post.setRequestHeader(HEADER_CONTENT_LENGTH, Long.toString(post.getRequestEntity().getContentLength()));
+        post.setRequestHeader(HTTPConstants.HEADER_CONTENT_LENGTH, Long.toString(post.getRequestEntity().getContentLength()));
 
         return postedBody.toString();
     }
@@ -939,7 +940,7 @@ public class HTTPHC3Impl extends HTTPHCA
 
         // Check if the header manager had a content type header
         // This allows the user to specify his own content-type for a POST request
-        Header contentTypeHeader = put.getRequestHeader(HEADER_CONTENT_TYPE);
+        Header contentTypeHeader = put.getRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE);
         boolean hasContentTypeHeader = contentTypeHeader != null && contentTypeHeader.getValue() != null && contentTypeHeader.getValue().length() > 0;
         HTTPFileArg files[] = getHTTPFiles();
 
@@ -986,7 +987,7 @@ public class HTTPHC3Impl extends HTTPHCA
             }
             String contentTypeValue = null;
             if(hasContentTypeHeader) {
-                contentTypeValue = put.getRequestHeader(HEADER_CONTENT_TYPE).getValue();
+                contentTypeValue = put.getRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE).getValue();
             }
             StringRequestEntity requestEntity = new StringRequestEntity(putBodyContent.toString(), contentTypeValue, put.getRequestCharSet());
             put.setRequestEntity(requestEntity);
@@ -1013,11 +1014,11 @@ public class HTTPHC3Impl extends HTTPHCA
                 // TODO: needs a multiple file upload scenerio
                 HTTPFileArg file = files.length > 0? files[0] : null;
                 if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
-                    put.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                    put.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                 }
             }
             // Set the content length
-            put.setRequestHeader(HEADER_CONTENT_LENGTH, Long.toString(put.getRequestEntity().getContentLength()));
+            put.setRequestHeader(HTTPConstants.HEADER_CONTENT_LENGTH, Long.toString(put.getRequestEntity().getContentLength()));
             return putBody.toString();
         }
         return null;
@@ -1065,7 +1066,7 @@ public class HTTPHC3Impl extends HTTPHCA
      */
     protected void saveConnectionCookies(HttpMethod method, URL u, CookieManager cookieManager) {
         if (cookieManager != null) {
-            Header hdr[] = method.getResponseHeaders(HEADER_SET_COOKIE);
+            Header hdr[] = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
             for (int i = 0; i < hdr.length; i++) {
                 cookieManager.addCookieFromHeader(hdr[i].getValue(),u);
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Sat Jun 23 15:36:18 2012
@@ -98,6 +98,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.util.EncoderCache;
 import org.apache.jmeter.protocol.http.util.HC4TrustAllSSLSocketFactory;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.protocol.http.util.SlowHC4SSLSocketFactory;
 import org.apache.jmeter.protocol.http.util.SlowHC4SocketFactory;
@@ -175,7 +176,7 @@ public class HTTPHC4Impl extends HTTPHCA
         // Set up HTTP scheme override if necessary
         if (CPS_HTTP > 0) {
             log.info("Setting up HTTP SlowProtocol, cps="+CPS_HTTP);
-            SLOW_HTTP = new Scheme(PROTOCOL_HTTP, DEFAULT_HTTP_PORT, new SlowHC4SocketFactory(CPS_HTTP));
+            SLOW_HTTP = new Scheme(HTTPConstants.PROTOCOL_HTTP, HTTPConstants.DEFAULT_HTTP_PORT, new SlowHC4SocketFactory(CPS_HTTP));
         } else {
             SLOW_HTTP = null;
         }
@@ -185,14 +186,14 @@ public class HTTPHC4Impl extends HTTPHCA
         if (CPS_HTTPS > 0) {
             log.info("Setting up HTTPS SlowProtocol, cps="+CPS_HTTPS);
             try {
-                https = new Scheme(PROTOCOL_HTTPS, DEFAULT_HTTPS_PORT, new SlowHC4SSLSocketFactory(CPS_HTTPS));
+                https = new Scheme(HTTPConstants.PROTOCOL_HTTPS, HTTPConstants.DEFAULT_HTTPS_PORT, new SlowHC4SSLSocketFactory(CPS_HTTPS));
             } catch (GeneralSecurityException e) {
                 log.warn("Failed to initialise SLOW_HTTPS scheme, cps="+CPS_HTTPS, e);
             }
         } else {
             log.info("Setting up HTTPS TrustAll scheme");
             try {
-                https = new Scheme(PROTOCOL_HTTPS, DEFAULT_HTTPS_PORT, new HC4TrustAllSSLSocketFactory());
+                https = new Scheme(HTTPConstants.PROTOCOL_HTTPS, HTTPConstants.DEFAULT_HTTPS_PORT, new HC4TrustAllSSLSocketFactory());
             } catch (GeneralSecurityException e) {
                 log.warn("Failed to initialise HTTPS TrustAll scheme", e);
             }
@@ -226,19 +227,19 @@ public class HTTPHC4Impl extends HTTPHCA
         HttpRequestBase httpRequest = null;
         try {
             URI uri = url.toURI();
-            if (method.equals(POST)) {
+            if (method.equals(HTTPConstants.POST)) {
                 httpRequest = new HttpPost(uri);
-            } else if (method.equals(PUT)) {
+            } else if (method.equals(HTTPConstants.PUT)) {
                 httpRequest = new HttpPut(uri);
-            } else if (method.equals(HEAD)) {
+            } else if (method.equals(HTTPConstants.HEAD)) {
                 httpRequest = new HttpHead(uri);
-            } else if (method.equals(TRACE)) {
+            } else if (method.equals(HTTPConstants.TRACE)) {
                 httpRequest = new HttpTrace(uri);
-            } else if (method.equals(OPTIONS)) {
+            } else if (method.equals(HTTPConstants.OPTIONS)) {
                 httpRequest = new HttpOptions(uri);
-            } else if (method.equals(DELETE)) {
+            } else if (method.equals(HTTPConstants.DELETE)) {
                 httpRequest = new HttpDelete(uri);
-            } else if (method.equals(GET)) {
+            } else if (method.equals(HTTPConstants.GET)) {
                 httpRequest = new HttpGet(uri);
             } else {
                 throw new IllegalArgumentException("Unexpected method: "+method);
@@ -256,7 +257,7 @@ public class HTTPHC4Impl extends HTTPHCA
         res.sampleStart();
 
         final CacheManager cacheManager = getCacheManager();
-        if (cacheManager != null && GET.equalsIgnoreCase(method)) {
+        if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
            if (cacheManager.inCache(url)) {
                res.sampleEnd();
                res.setResponseNoContent();
@@ -268,10 +269,10 @@ public class HTTPHC4Impl extends HTTPHCA
         try {
             currentRequest = httpRequest;
             // Handle the various methods
-            if (method.equals(POST)) {
+            if (method.equals(HTTPConstants.POST)) {
                 String postBody = sendPostData((HttpPost)httpRequest);
                 res.setQueryString(postBody);
-            } else if (method.equals(PUT)) {
+            } else if (method.equals(HTTPConstants.PUT)) {
                 String putBody = sendPutData((HttpPut)httpRequest);
                 res.setQueryString(putBody);
             }
@@ -280,7 +281,7 @@ public class HTTPHC4Impl extends HTTPHCA
             // Needs to be done after execute to pick up all the headers
             res.setRequestHeaders(getConnectionHeaders((HttpRequest) localContext.getAttribute(ExecutionContext.HTTP_REQUEST)));
 
-            Header contentType = httpResponse.getLastHeader(HEADER_CONTENT_TYPE);
+            Header contentType = httpResponse.getLastHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             if (contentType != null){
                 String ct = contentType.getValue();
                 res.setContentType(ct);
@@ -304,7 +305,7 @@ public class HTTPHC4Impl extends HTTPHCA
 
             res.setResponseHeaders(getResponseHeaders(httpResponse));
             if (res.isRedirect()) {
-                final Header headerLocation = httpResponse.getLastHeader(HEADER_LOCATION);
+                final Header headerLocation = httpResponse.getLastHeader(HTTPConstants.HEADER_LOCATION);
                 if (headerLocation == null) { // HTTP protocol violation, but avoids NPE
                     throw new IllegalArgumentException("Missing location header");
                 }
@@ -594,9 +595,9 @@ public class HTTPHC4Impl extends HTTPHCA
     // leave it to the server to close the connection after their
     // timeout period. Leave it to the JMeter user to decide.
     if (getUseKeepAlive()) {
-        httpRequest.setHeader(HEADER_CONNECTION, KEEP_ALIVE);
+        httpRequest.setHeader(HTTPConstants.HEADER_CONNECTION, HTTPConstants.KEEP_ALIVE);
     } else {
-        httpRequest.setHeader(HEADER_CONNECTION, CONNECTION_CLOSE);
+        httpRequest.setHeader(HTTPConstants.HEADER_CONNECTION, HTTPConstants.CONNECTION_CLOSE);
     }
 
     setConnectionHeaders(httpRequest, url, getHeaderManager(), getCacheManager());
@@ -656,7 +657,7 @@ public class HTTPHC4Impl extends HTTPHCA
         if (cookieManager != null) {
             cookieHeader = cookieManager.getCookieHeaderForURL(url);
             if (cookieHeader != null) {
-                request.setHeader(HEADER_COOKIE, cookieHeader);
+                request.setHeader(HTTPConstants.HEADER_COOKIE, cookieHeader);
             }
         }
         return cookieHeader;
@@ -687,9 +688,9 @@ public class HTTPHC4Impl extends HTTPHCA
                     String n = header.getName();
                     // Don't allow override of Content-Length
                     // TODO - what other headers are not allowed?
-                    if (! HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
+                    if (! HTTPConstants.HEADER_CONTENT_LENGTH.equalsIgnoreCase(n)){
                         String v = header.getValue();
-                        if (HEADER_HOST.equalsIgnoreCase(n)) {
+                        if (HTTPConstants.HEADER_HOST.equalsIgnoreCase(n)) {
                             int port = url.getPort();
                             v = v.replaceFirst(":\\d+$",""); // remove any port specification // $NON-NLS-1$ $NON-NLS-2$
                             if (port != -1) {
@@ -723,7 +724,7 @@ public class HTTPHC4Impl extends HTTPHCA
         Header[] requestHeaders = method.getAllHeaders();
         for(int i = 0; i < requestHeaders.length; i++) {
             // Exclude the COOKIE header, since cookie is reported separately in the sample
-            if(!HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
+            if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(requestHeaders[i].getName())) {
                 hdrs.append(requestHeaders[i].getName());
                 hdrs.append(": "); // $NON-NLS-1$
                 hdrs.append(requestHeaders[i].getValue());
@@ -852,7 +853,7 @@ public class HTTPHC4Impl extends HTTPHCA
         } else { // not multipart
             // Check if the header manager had a content type header
             // This allows the user to specify his own content-type for a POST request
-            Header contentTypeHeader = post.getFirstHeader(HEADER_CONTENT_TYPE);
+            Header contentTypeHeader = post.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             boolean hasContentTypeHeader = contentTypeHeader != null && contentTypeHeader.getValue() != null && contentTypeHeader.getValue().length() > 0;
             // If there are no arguments, we can send a file as the body of the request
             // TODO: needs a multiple file upload scenerio
@@ -862,10 +863,10 @@ public class HTTPHC4Impl extends HTTPHCA
                 if(!hasContentTypeHeader) {
                     // Allow the mimetype of the file to control the content type
                     if(file.getMimeType() != null && file.getMimeType().length() > 0) {
-                        post.setHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                        post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                     }
                     else {
-                        post.setHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                        post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
                 }
 
@@ -899,11 +900,11 @@ public class HTTPHC4Impl extends HTTPHCA
                     if(!hasContentTypeHeader) {
                         HTTPFileArg file = files.length > 0? files[0] : null;
                         if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
-                            post.setHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                            post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                         }
                         else {
                              // TODO - is this the correct default?
-                            post.setHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                            post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                         }
                     }
 
@@ -921,7 +922,7 @@ public class HTTPHC4Impl extends HTTPHCA
                         postBody.append(value);
                     }
                     ContentType contentType = 
-                            ContentType.create(post.getFirstHeader(HEADER_CONTENT_TYPE).getValue(), contentEncoding);
+                            ContentType.create(post.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE).getValue(), contentEncoding);
                     StringEntity requestEntity = new StringEntity(postBody.toString(), contentType);
                     post.setEntity(requestEntity);
                     postedBody.append(postBody.toString()); // TODO OK?
@@ -930,7 +931,7 @@ public class HTTPHC4Impl extends HTTPHCA
 
                     // Set the content type
                     if(!hasContentTypeHeader) {
-                        post.setHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);
+                        post.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
                     // Add the parameters
                     PropertyIterator args = getArguments().iterator();
@@ -1009,7 +1010,7 @@ public class HTTPHC4Impl extends HTTPHCA
 
         // Check if the header manager had a content type header
         // This allows the user to specify his own content-type
-        Header contentTypeHeader = put.getFirstHeader(HEADER_CONTENT_TYPE);
+        Header contentTypeHeader = put.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE);
         boolean hasContentTypeHeader = contentTypeHeader != null && contentTypeHeader.getValue() != null && contentTypeHeader.getValue().length() > 0;
 
         // Check for local contentEncoding override
@@ -1057,7 +1058,7 @@ public class HTTPHC4Impl extends HTTPHCA
             }
             String contentTypeValue = null;
             if(hasContentTypeHeader) {
-                contentTypeValue = put.getFirstHeader(HEADER_CONTENT_TYPE).getValue();
+                contentTypeValue = put.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE).getValue();
             }
             ContentType contentType = 
                     ContentType.create(contentTypeValue, charset);
@@ -1089,7 +1090,7 @@ public class HTTPHC4Impl extends HTTPHCA
                 // TODO: needs a multiple file upload scenerio
                 HTTPFileArg file = files.length > 0? files[0] : null;
                 if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
-                    put.setHeader(HEADER_CONTENT_TYPE, file.getMimeType());
+                    put.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                 }
             }
             return putBody.toString();
@@ -1112,7 +1113,7 @@ public class HTTPHC4Impl extends HTTPHCA
 
     private void saveConnectionCookies(HttpResponse method, URL u, CookieManager cookieManager) {
         if (cookieManager != null) {
-            Header[] hdrs = method.getHeaders(HEADER_SET_COOKIE);
+            Header[] hdrs = method.getHeaders(HTTPConstants.HEADER_SET_COOKIE);
             for (Header hdr : hdrs) {
                 cookieManager.addCookieFromHeader(hdr.getValue(),u);
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java Sat Jun 23 15:36:18 2012
@@ -39,7 +39,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.CookieManager;
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.property.CollectionProperty;
@@ -138,7 +138,7 @@ public class HTTPJavaImpl extends HTTPAb
      */
     protected HttpURLConnection setupConnection(URL u, String method, HTTPSampleResult res) throws IOException {
         SSLManager sslmgr = null;
-        if (PROTOCOL_HTTPS.equalsIgnoreCase(u.getProtocol())) {
+        if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(u.getProtocol())) {
             try {
                 sslmgr=SSLManager.getInstance(); // N.B. this needs to be done before opening the connection
             } catch (Exception e) {
@@ -175,7 +175,7 @@ public class HTTPJavaImpl extends HTTPAb
             conn.setReadTimeout(rto);
         }
 
-        if (HTTPConstantsInterface.PROTOCOL_HTTPS.equalsIgnoreCase(u.getProtocol())) {
+        if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(u.getProtocol())) {
             try {
                 if (null != sslmgr){
                     sslmgr.setContext(conn); // N.B. must be done after opening connection
@@ -190,9 +190,9 @@ public class HTTPJavaImpl extends HTTPAb
         // leave it to the server to close the connection after their
         // timeout period. Leave it to the JMeter user to decide.
         if (getUseKeepAlive()) {
-            conn.setRequestProperty(HEADER_CONNECTION, KEEP_ALIVE);
+            conn.setRequestProperty(HTTPConstants.HEADER_CONNECTION, HTTPConstants.KEEP_ALIVE);
         } else {
-            conn.setRequestProperty(HEADER_CONNECTION, CONNECTION_CLOSE);
+            conn.setRequestProperty(HTTPConstants.HEADER_CONNECTION, HTTPConstants.CONNECTION_CLOSE);
         }
 
         conn.setRequestMethod(method);
@@ -201,9 +201,9 @@ public class HTTPJavaImpl extends HTTPAb
 
         setConnectionAuthorization(conn, u, getAuthManager());
 
-        if (method.equals(POST)) {
+        if (method.equals(HTTPConstants.POST)) {
             setPostHeaders(conn);
-        } else if (method.equals(PUT)) {
+        } else if (method.equals(HTTPConstants.PUT)) {
             setPutHeaders(conn);
         }
 
@@ -237,7 +237,7 @@ public class HTTPJavaImpl extends HTTPAb
         }
 
         // works OK even if ContentEncoding is null
-        boolean gzipped = ENCODING_GZIP.equals(conn.getContentEncoding());
+        boolean gzipped = HTTPConstants.ENCODING_GZIP.equals(conn.getContentEncoding());
         InputStream instream = null;
         try {
             instream = new CountingInputStream(conn.getInputStream());
@@ -337,7 +337,7 @@ public class HTTPJavaImpl extends HTTPAb
         if (cookieManager != null) {
             cookieHeader = cookieManager.getCookieHeaderForURL(u);
             if (cookieHeader != null) {
-                conn.setRequestProperty(HEADER_COOKIE, cookieHeader);
+                conn.setRequestProperty(HTTPConstants.HEADER_COOKIE, cookieHeader);
             }
         }
         return cookieHeader;
@@ -391,7 +391,7 @@ public class HTTPJavaImpl extends HTTPAb
         for(Map.Entry<String, List<String>> entry : requestHeaders.entrySet()) {
             String headerKey=entry.getKey();
             // Exclude the COOKIE header, since cookie is reported separately in the sample
-            if(!HEADER_COOKIE.equalsIgnoreCase(headerKey)) {
+            if(!HTTPConstants.HEADER_COOKIE.equalsIgnoreCase(headerKey)) {
                 // value is a List of Strings
                 for (String value : entry.getValue()){
                     hdrs.append(headerKey);
@@ -421,7 +421,7 @@ public class HTTPJavaImpl extends HTTPAb
         if (authManager != null) {
             Authorization auth = authManager.getAuthForURL(u);
             if (auth != null) {
-                conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
+                conn.setRequestProperty(HTTPConstants.HEADER_AUTHORIZATION, auth.toBasicHeader());
             }
         }
     }
@@ -463,7 +463,7 @@ public class HTTPJavaImpl extends HTTPAb
 
         // Check cache for an entry with an Expires header in the future
         final CacheManager cacheManager = getCacheManager();
-        if (cacheManager != null && GET.equalsIgnoreCase(method)) {
+        if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
            if (cacheManager.inCache(url)) {
                res.sampleEnd();
                res.setResponseNoContent();
@@ -506,11 +506,11 @@ public class HTTPJavaImpl extends HTTPAb
                 throw new BindException();
             }
             // Nice, we've got a connection. Finish sending the request:
-            if (method.equals(POST)) {
+            if (method.equals(HTTPConstants.POST)) {
                 String postBody = sendPostData(conn);
                 res.setQueryString(postBody);
             }
-            else if (method.equals(PUT)) {
+            else if (method.equals(HTTPConstants.PUT)) {
                 String putBody = sendPutData(conn);
                 res.setQueryString(putBody);
             }
@@ -565,7 +565,7 @@ public class HTTPJavaImpl extends HTTPAb
             String responseHeaders = getResponseHeaders(conn);
             res.setResponseHeaders(responseHeaders);
             if (res.isRedirect()) {
-                res.setRedirectLocation(conn.getHeaderField(HEADER_LOCATION));
+                res.setRedirectLocation(conn.getHeaderField(HTTPConstants.HEADER_LOCATION));
             }
             
             // record headers size to allow HTTPSampleResult.getBytes() with different options
@@ -613,10 +613,10 @@ public class HTTPJavaImpl extends HTTPAb
 
     protected void disconnect(HttpURLConnection conn) {
         if (conn != null) {
-            String connection = conn.getHeaderField(HEADER_CONNECTION);
+            String connection = conn.getHeaderField(HTTPConstants.HEADER_CONNECTION);
             String protocol = conn.getHeaderField(0);
-            if ((connection == null && (protocol == null || !protocol.startsWith(HTTP_1_1)))
-                    || (connection != null && connection.equalsIgnoreCase(CONNECTION_CLOSE))) {
+            if ((connection == null && (protocol == null || !protocol.startsWith(HTTPConstants.HTTP_1_1)))
+                    || (connection != null && connection.equalsIgnoreCase(HTTPConstants.CONNECTION_CLOSE))) {
                 conn.disconnect();
             } // TODO ? perhaps note connection so it can be disconnected at end of test?
         }
@@ -638,7 +638,7 @@ public class HTTPJavaImpl extends HTTPAb
     private void saveConnectionCookies(HttpURLConnection conn, URL u, CookieManager cookieManager) {
         if (cookieManager != null) {
             for (int i = 1; conn.getHeaderFieldKey(i) != null; i++) {
-                if (conn.getHeaderFieldKey(i).equalsIgnoreCase(HEADER_SET_COOKIE)) {
+                if (conn.getHeaderFieldKey(i).equalsIgnoreCase(HTTPConstants.HEADER_SET_COOKIE)) {
                     cookieManager.addCookieFromHeader(conn.getHeaderField(i), u);
                 }
             }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java Sat Jun 23 15:36:18 2012
@@ -21,7 +21,7 @@ package org.apache.jmeter.protocol.http.
 import java.net.HttpURLConnection;
 import java.net.URL;
 
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.samplers.SampleResult;
 
 /**
@@ -119,7 +119,7 @@ public class HTTPSampleResult extends Sa
             sb.append(u.toString());
             sb.append("\n");
             // Include request body if it is a post or put
-            if (HTTPConstantsInterface.POST.equals(method) || HTTPConstantsInterface.PUT.equals(method)) {
+            if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method)) {
                 sb.append("\n"+method+" data:\n");
                 sb.append(queryString);
                 sb.append("\n");

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Sat Jun 23 15:36:18 2012
@@ -58,6 +58,7 @@ import org.apache.jmeter.protocol.http.p
 import org.apache.jmeter.protocol.http.util.ConversionUtils;
 import org.apache.jmeter.protocol.http.util.EncoderCache;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.protocol.http.util.HTTPFileArgs;
@@ -150,7 +151,7 @@ public abstract class HTTPSamplerBase ex
 
     static final String PROTOCOL_FILE = "file"; // $NON-NLS-1$
 
-    private static final String DEFAULT_PROTOCOL = PROTOCOL_HTTP;
+    private static final String DEFAULT_PROTOCOL = HTTPConstants.PROTOCOL_HTTP;
 
     public static final String URL = "HTTPSampler.URL"; // $NON-NLS-1$
 
@@ -186,16 +187,16 @@ public abstract class HTTPSamplerBase ex
     public static final int CONCURRENT_POOL_SIZE = 4; // Default concurrent pool size for download embedded resources
     
     
-    public static final String DEFAULT_METHOD = GET; // $NON-NLS-1$
+    public static final String DEFAULT_METHOD = HTTPConstants.GET; // $NON-NLS-1$
     // Supported methods:
     private static final String [] METHODS = {
         DEFAULT_METHOD, // i.e. GET
-        POST,
-        HEAD,
-        PUT,
-        OPTIONS,
-        TRACE,
-        DELETE,
+        HTTPConstants.POST,
+        HTTPConstants.HEAD,
+        HTTPConstants.PUT,
+        HTTPConstants.OPTIONS,
+        HTTPConstants.TRACE,
+        HTTPConstants.DELETE,
         };
 
     private static final List<String> METHODLIST = Collections.unmodifiableList(Arrays.asList(METHODS));
@@ -353,7 +354,7 @@ public abstract class HTTPSamplerBase ex
         // We use multipart if we have been told so, or files are present
         // and the files should not be send as the post body
         HTTPFileArg[] files = getHTTPFiles();
-        if(POST.equals(getMethod()) && (getDoMultipartPost() || (files.length > 0 && !getSendFileAsPostBody()))) {
+        if(HTTPConstants.POST.equals(getMethod()) && (getDoMultipartPost() || (files.length > 0 && !getSendFileAsPostBody()))) {
             return true;
         }
         return false;
@@ -398,7 +399,7 @@ public abstract class HTTPSamplerBase ex
      *            The encoding used for the querystring parameter values
      */
     public void setPath(String path, String contentEncoding) {
-        if (GET.equals(getMethod()) || DELETE.equals(getMethod())) {
+        if (HTTPConstants.GET.equals(getMethod()) || HTTPConstants.DELETE.equals(getMethod())) {
             int index = path.indexOf(QRY_PFX);
             if (index > -1) {
                 setProperty(PATH, path.substring(0, index));
@@ -616,8 +617,8 @@ public abstract class HTTPSamplerBase ex
     public static int getDefaultPort(String protocol,int port){
         if (port==URL_UNSPECIFIED_PORT){
             return
-                protocol.equalsIgnoreCase(PROTOCOL_HTTP)  ? DEFAULT_HTTP_PORT :
-                protocol.equalsIgnoreCase(PROTOCOL_HTTPS) ? DEFAULT_HTTPS_PORT :
+                protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTP)  ? HTTPConstants.DEFAULT_HTTP_PORT :
+                protocol.equalsIgnoreCase(HTTPConstants.PROTOCOL_HTTPS) ? HTTPConstants.DEFAULT_HTTPS_PORT :
                     port;
         }
         return port;
@@ -646,8 +647,8 @@ public abstract class HTTPSamplerBase ex
         final int port = getPortIfSpecified();
         final String protocol = getProtocol();
         if (port == UNSPECIFIED_PORT ||
-                (PROTOCOL_HTTP.equalsIgnoreCase(protocol) && port == DEFAULT_HTTP_PORT) ||
-                (PROTOCOL_HTTPS.equalsIgnoreCase(protocol) && port == DEFAULT_HTTPS_PORT)) {
+                (HTTPConstants.PROTOCOL_HTTP.equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTP_PORT) ||
+                (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(protocol) && port == HTTPConstants.DEFAULT_HTTPS_PORT)) {
             return true;
         }
         return false;
@@ -662,14 +663,14 @@ public abstract class HTTPSamplerBase ex
         final int port = getPortIfSpecified();
         if (port == UNSPECIFIED_PORT) {
             String prot = getProtocol();
-            if (PROTOCOL_HTTPS.equalsIgnoreCase(prot)) {
-                return DEFAULT_HTTPS_PORT;
+            if (HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(prot)) {
+                return HTTPConstants.DEFAULT_HTTPS_PORT;
             }
-            if (!PROTOCOL_HTTP.equalsIgnoreCase(prot)) {
+            if (!HTTPConstants.PROTOCOL_HTTP.equalsIgnoreCase(prot)) {
                 log.warn("Unexpected protocol: "+prot);
                 // TODO - should this return something else?
             }
-            return DEFAULT_HTTP_PORT;
+            return HTTPConstants.DEFAULT_HTTP_PORT;
         }
         return port;
     }
@@ -834,8 +835,8 @@ public abstract class HTTPSamplerBase ex
         return res;
     }
 
-    private static final String HTTP_PREFIX = PROTOCOL_HTTP+"://"; // $NON-NLS-1$
-    private static final String HTTPS_PREFIX = PROTOCOL_HTTPS+"://"; // $NON-NLS-1$
+    private static final String HTTP_PREFIX = HTTPConstants.PROTOCOL_HTTP+"://"; // $NON-NLS-1$
+    private static final String HTTPS_PREFIX = HTTPConstants.PROTOCOL_HTTPS+"://"; // $NON-NLS-1$
 
     // Bug 51939
     private static final boolean SEPARATE_CONTAINER = 
@@ -873,7 +874,7 @@ public abstract class HTTPSamplerBase ex
         pathAndQuery.append(path);
 
         // Add the query string if it is a HTTP GET or DELETE request
-        if(GET.equals(getMethod()) || DELETE.equals(getMethod())) {
+        if(HTTPConstants.GET.equals(getMethod()) || HTTPConstants.DELETE.equals(getMethod())) {
             // Get the query string encoded in specified encoding
             // If no encoding is specified by user, we will get it
             // encoded in UTF-8, which is what the HTTP spec says
@@ -1028,7 +1029,7 @@ public abstract class HTTPSamplerBase ex
             StringBuilder stringBuffer = new StringBuilder();
             stringBuffer.append(this.getUrl().toString());
             // Append body if it is a post or put
-            if(POST.equals(getMethod()) || PUT.equals(getMethod())) {
+            if(HTTPConstants.POST.equals(getMethod()) || HTTPConstants.PUT.equals(getMethod())) {
                 stringBuffer.append("\nQuery Data: ");
                 stringBuffer.append(getQueryString());
             }
@@ -1173,10 +1174,10 @@ public abstract class HTTPSamplerBase ex
                         
                         if (isConcurrentDwn()) {
                             // if concurrent download emb. resources, add to a list for async gets later
-                            liste.add(new ASyncSample(url, GET, false, frameDepth + 1, getCookieManager(), this));
+                            liste.add(new ASyncSample(url, HTTPConstants.GET, false, frameDepth + 1, getCookieManager(), this));
                         } else {
                             // default: serial download embedded resources
-                            HTTPSampleResult binRes = sample(url, GET, false, frameDepth + 1);
+                            HTTPSampleResult binRes = sample(url, HTTPConstants.GET, false, frameDepth + 1);
                             res.addSubResult(binRes);
                             setParentSampleSuccess(res, res.isSuccessful() && binRes.isSuccessful());
                         }
@@ -1372,7 +1373,7 @@ public abstract class HTTPSamplerBase ex
             }
             location = encodeSpaces(location);
             try {
-                lastRes = sample(ConversionUtils.makeRelativeURL(lastRes.getURL(), location), GET, true, frameDepth);
+                lastRes = sample(ConversionUtils.makeRelativeURL(lastRes.getURL(), location), HTTPConstants.GET, true, frameDepth);
             } catch (MalformedURLException e) {
                 errorResult(e, lastRes);
                 // The redirect URL we got was not a valid URL
@@ -1556,7 +1557,7 @@ public abstract class HTTPSamplerBase ex
     }
 
     public static boolean isSecure(String protocol){
-        return PROTOCOL_HTTPS.equalsIgnoreCase(protocol);
+        return HTTPConstants.PROTOCOL_HTTPS.equalsIgnoreCase(protocol);
     }
 
     public static boolean isSecure(URL url){

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java?rev=1353149&r1=1353148&r2=1353149&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java Sat Jun 23 15:36:18 2012
@@ -29,7 +29,7 @@ import java.io.UnsupportedEncodingExcept
 import java.net.URLConnection;
 
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
-import org.apache.jmeter.protocol.http.util.HTTPConstantsInterface;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.property.PropertyIterator;
@@ -177,8 +177,8 @@ public class PostWriter {
         if(sampler.getUseMultipartForPost()) {
             // Set the content type
             connection.setRequestProperty(
-                    HTTPConstantsInterface.HEADER_CONTENT_TYPE,
-                    HTTPConstantsInterface.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();
@@ -238,7 +238,7 @@ public class PostWriter {
             contentLength += getMultipartEndDivider().length;
 
             // Set the content length
-            connection.setRequestProperty(HTTPConstantsInterface.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);
@@ -247,7 +247,7 @@ public class PostWriter {
         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(HTTPConstantsInterface.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
@@ -258,10 +258,10 @@ public class PostWriter {
                 if(!hasContentTypeHeader) {
                     // Allow the mimetype of the file to control the content type
                     if(file.getMimeType() != null && file.getMimeType().length() > 0) {
-                        connection.setRequestProperty(HTTPConstantsInterface.HEADER_CONTENT_TYPE, file.getMimeType());
+                        connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                     }
                     else {
-                        connection.setRequestProperty(HTTPConstantsInterface.HEADER_CONTENT_TYPE, HTTPConstantsInterface.APPLICATION_X_WWW_FORM_URLENCODED);
+                        connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                     }
                 }
                 // Create the content length we are going to write
@@ -278,7 +278,7 @@ public class PostWriter {
                 if(!sampler.getSendParameterValuesAsPostBody()) {
                     // Set the content type
                     if(!hasContentTypeHeader) {
-                        connection.setRequestProperty(HTTPConstantsInterface.HEADER_CONTENT_TYPE, HTTPConstantsInterface.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
@@ -292,11 +292,11 @@ public class PostWriter {
                     if(!hasContentTypeHeader) {
                         HTTPFileArg file = files.length > 0? files[0] : null;
                         if(file != null && file.getMimeType() != null && file.getMimeType().length() > 0) {
-                            connection.setRequestProperty(HTTPConstantsInterface.HEADER_CONTENT_TYPE, file.getMimeType());
+                            connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());
                         }
                         else {
                             // TODO: is this the correct default?
-                            connection.setRequestProperty(HTTPConstantsInterface.HEADER_CONTENT_TYPE, HTTPConstantsInterface.APPLICATION_X_WWW_FORM_URLENCODED);
+                            connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);
                         }
                     }
 
@@ -320,7 +320,7 @@ public class PostWriter {
             }
 
             // Set the content length
-            connection.setRequestProperty(HTTPConstantsInterface.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);