final ContentType contentType = ContentType.parseLenient(entityDetails.getContentType()); entityConsumer.streamStart(entityDetails, new FutureCallback<byte[]>() {
/** * Extracts {@code Content-Type} value from {@link HttpEntity}. Returns {@code null} * if not specified or incorrect (could not be parsed).. * * @param entity HTTP entity * @return content type * * @since 4.4 * */ public static ContentType getContentTypeLenient(final HttpEntity entity) { if (entity == null) { return null; } final String contentType = entity.getContentType(); if (contentType != null) { return ContentType.parseLenient(contentType); } return null; }
/** * Extracts {@code Content-Type} value from {@link HttpEntity}. Returns {@code null} * if not specified or incorrect (could not be parsed).. * * @param entity HTTP entity * @return content type * * @since 4.4 * */ public static ContentType getContentTypeLenient(final HttpEntity entity) { if (entity == null) { return null; } final String contentType = entity.getContentType(); if (contentType != null) { return ContentType.parseLenient(contentType); } return null; }
@Override public void consumeResponse( final HttpResponse response, final EntityDetails entityDetails, final HttpContext context, final FutureCallback<Void> resultCallback) throws HttpException, IOException { status = response.getCode(); resultCallbackRef.set(resultCallback); stats.setVersion(response.getVersion()); final Header serverHeader = response.getFirstHeader(HttpHeaders.SERVER); if (serverHeader != null) { stats.setServerName(serverHeader.getValue()); } if (config.getVerbosity() >= 2) { System.out.println(response.getCode()); } if (entityDetails != null) { if (config.getVerbosity() >= 6) { if (entityDetails.getContentType() != null) { final ContentType contentType = ContentType.parseLenient(entityDetails.getContentType()); charset = contentType.getCharset(); } } } else { streamEnd(null); } }
@Override public void consumeResponse( final HttpResponse response, final EntityDetails entityDetails, final HttpContext context, final FutureCallback<Void> resultCallback) throws HttpException, IOException { status = response.getCode(); resultCallbackRef.set(resultCallback); stats.setVersion(response.getVersion()); final Header serverHeader = response.getFirstHeader(HttpHeaders.SERVER); if (serverHeader != null) { stats.setServerName(serverHeader.getValue()); } if (config.getVerbosity() >= 2) { System.out.println(response.getCode()); } if (entityDetails != null) { if (config.getVerbosity() >= 6) { if (entityDetails.getContentType() != null) { final ContentType contentType = ContentType.parseLenient(entityDetails.getContentType()); charset = contentType.getCharset(); } } } else { streamEnd(null); } }