You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/12/04 14:31:10 UTC
svn commit: r1772539 -
/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/protocol/AbstractAsyncResponseConsumer.java
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));
}
}