You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/12/10 03:52:49 UTC

svn commit: r1044204 - in /jakarta/jmeter/trunk: bin/hc.parameters bin/httpclient.parameters src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java

Author: sebb
Date: Fri Dec 10 02:52:48 2010
New Revision: 1044204

URL: http://svn.apache.org/viewvc?rev=1044204&view=rev
Log:
Support Apache version of HttpVersion

Added:
    jakarta/jmeter/trunk/bin/hc.parameters
Modified:
    jakarta/jmeter/trunk/bin/httpclient.parameters
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java

Added: jakarta/jmeter/trunk/bin/hc.parameters
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/hc.parameters?rev=1044204&view=auto
==============================================================================
--- jakarta/jmeter/trunk/bin/hc.parameters (added)
+++ jakarta/jmeter/trunk/bin/hc.parameters Fri Dec 10 02:52:48 2010
@@ -0,0 +1,42 @@
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+# 
+#       http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+# Properties file used to define additional default Apache HttpClient parameters
+#
+#
+# This file is enabled by setting the JMeter property: hc.parameters.file
+# entries are of the form:
+#
+# property=value (for strings)
+# property$Type=value (for other types)
+#
+# where Type can be:
+# Integer
+# Long
+# Boolean
+# HttpVersion
+#
+# N.B. Other types are not yet implemented
+#
+
+# Examples:
+
+#http.protocol.version$HttpVersion=1.0
+
+#http.protocol.element-charset=ISO-8859-1
+
+#http.socket.timeout$Integer=10000
+
+#http.protocol.reject-relative-redirect$Boolean=true

Modified: jakarta/jmeter/trunk/bin/httpclient.parameters
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/httpclient.parameters?rev=1044204&r1=1044203&r2=1044204&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/httpclient.parameters (original)
+++ jakarta/jmeter/trunk/bin/httpclient.parameters Fri Dec 10 02:52:48 2010
@@ -13,7 +13,7 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
-# Properties file used to define additional httpclient parameters
+# Properties file used to define additional default Commons HttpClient parameters
 #
 # See: http://hc.apache.org/httpclient-3.x/preference-api.html
 #

Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java?rev=1044204&r1=1044203&r2=1044204&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java Fri Dec 10 02:52:48 2010
@@ -24,7 +24,6 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 
@@ -49,6 +48,7 @@ public class HttpClientDefaultParameters
     // Helper class (callback) for applying parameter definitions
     private static abstract class GenericHttpParams {
         public abstract void setParameter(String name, Object value);
+        public abstract void setVersion(String name, String value) throws Exception;
     }
 
     /**
@@ -64,6 +64,11 @@ public class HttpClientDefaultParameters
                     @Override
                     public void setParameter(String name, Object value) {
                         params.setParameter(name, value);
+                    }
+                    @Override
+                    public void setVersion(String name, String value) throws Exception {
+                        params.setParameter(name,
+                        org.apache.commons.httpclient.HttpVersion.parse("HTTP/"+value));
                     }            
                 }
             );
@@ -82,6 +87,17 @@ public class HttpClientDefaultParameters
                     @Override
                     public void setParameter(String name, Object value) {
                         params.setParameter(name, value);
+                    }
+
+                    @Override
+                    public void setVersion(String name, String value) {
+                        String parts[] = value.split("\\.");
+                        if (parts.length != 2){
+                            throw new IllegalArgumentException("Version must have form m.n");
+                        }
+                        params.setParameter(name,
+                                new org.apache.http.HttpVersion(
+                                        Integer.parseInt(parts[0]), Integer.parseInt(parts[1])));
                     }            
                 }
             );



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org