hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1772539 - /httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
Date Sun, 04 Dec 2016 14:31:10 GMT
Author: olegk
Date: Sun Dec  4 14:31:10 2016
New Revision: 1772539

URL: http://svn.apache.org/viewvc?rev=1772539&view=rev
Log:
HTTPCORE-438: added protected #getContentType method to AbstractAsyncResponseConsumer for
customization of Content-Type parsing / inference logic

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java?rev=1772539&r1=1772538&r2=1772539&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
Sun Dec  4 14:31:10 2016
@@ -119,6 +119,13 @@ public abstract class AbstractAsyncRespo
     }
 
     /**
+     * @since 4.4
+     */
+    protected ContentType getContentType(final HttpEntity entity) {
+        return entity != null ? ContentType.getOrDefault(entity) : null;
+    }
+
+    /**
      * Use {@link #onResponseReceived(HttpResponse)} instead.
      */
     @Override
@@ -127,8 +134,7 @@ public abstract class AbstractAsyncRespo
         onResponseReceived(response);
         final HttpEntity entity = response.getEntity();
         if (entity != null) {
-            final ContentType contentType = ContentType.getOrDefault(entity);
-            onEntityEnclosed(entity, contentType);
+            onEntityEnclosed(entity, getContentType(entity));
         }
     }
 



Mime
View raw message