hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1238565 - in /httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark: BenchmarkWorker.java DefaultHeader.java HttpBenchmark.java
Date Tue, 31 Jan 2012 14:07:19 GMT
Author: olegk
Date: Tue Jan 31 14:07:19 2012
New Revision: 1238565

URL: http://svn.apache.org/viewvc?rev=1238565&view=rev
Log:
Removed deprecated calls

Modified:
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java
    httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java?rev=1238565&r1=1238564&r2=1238565&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkWorker.java
Tue Jan 31 14:07:19 2012
@@ -49,6 +49,7 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
+import org.apache.http.entity.ContentType;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.DefaultHttpClientConnection;
 import org.apache.http.params.BasicHttpParams;
@@ -65,7 +66,6 @@ import org.apache.http.protocol.RequestC
 import org.apache.http.protocol.RequestExpectContinue;
 import org.apache.http.protocol.RequestTargetHost;
 import org.apache.http.protocol.RequestUserAgent;
-import org.apache.http.util.EntityUtils;
 
 /**
  * Worker thread for the {@link HttpBenchmark HttpBenchmark}.
@@ -241,7 +241,8 @@ public class BenchmarkWorker implements 
 
                 HttpEntity entity = response.getEntity();
                 if (entity != null) {
-                    String charset = EntityUtils.getContentCharSet(entity);
+                    ContentType ct = ContentType.get(entity);
+                    String charset = ct.getCharset();
                     if (charset == null) {
                         charset = HTTP.DEFAULT_CONTENT_CHARSET;
                     }

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java?rev=1238565&r1=1238564&r2=1238565&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/DefaultHeader.java
Tue Jan 31 14:07:19 2012
@@ -31,6 +31,8 @@ import org.apache.http.message.BasicHead
 
 public class DefaultHeader extends BasicHeader {
 
+    private static final long serialVersionUID = 3465786867105185103L;
+
     public DefaultHeader(final String name, final String value) {
         super(name, value);
     }

Modified: httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java?rev=1238565&r1=1238564&r2=1238565&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
Tue Jan 31 14:07:19 2012
@@ -37,6 +37,7 @@ import org.apache.http.Header;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpVersion;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.FileEntity;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
@@ -107,13 +108,17 @@ public class HttpBenchmark {
 
         // Prepare requests for each thread
         if (config.getPayloadFile() != null) {
-            entity = new FileEntity(config.getPayloadFile(), config.getContentType());
-            ((FileEntity) entity).setChunked(config.isUseChunking());
+            FileEntity fe = new FileEntity(config.getPayloadFile());
+            fe.setContentType(config.getContentType());
+            fe.setChunked(config.isUseChunking());
+            entity = fe;
             contentLength = config.getPayloadFile().length();
 
         } else if (config.getPayloadText() != null) {
-            entity = new StringEntity(config.getPayloadText(), config.getContentType(), "UTF-8");
-            ((StringEntity) entity).setChunked(config.isUseChunking());
+            StringEntity se = new StringEntity(config.getPayloadText(), 
+                    ContentType.parse(config.getContentType()));
+            se.setChunked(config.isUseChunking());
+            entity = se;
             contentLength = config.getPayloadText().getBytes().length;
         }
         request = new HttpRequest[config.getThreads()];



Mime
View raw message