Fixed examples broken by HttpCore upgrade
This commit is contained in:
parent
f8653a011a
commit
74ae768e0d
|
@ -42,7 +42,6 @@ import org.apache.hc.core5.http.ContentType;
|
|||
import org.apache.hc.core5.http.HttpEntity;
|
||||
import org.apache.hc.core5.http.HttpStatus;
|
||||
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
@ -69,7 +68,7 @@ public class FluentResponseHandling {
|
|||
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
|
||||
ContentType contentType = EntityUtils.getContentTypeOrDefault(entity);
|
||||
ContentType contentType = ContentType.parseLenient(entity.getContentType());
|
||||
if (!contentType.equals(ContentType.APPLICATION_XML)) {
|
||||
throw new ClientProtocolException("Unexpected content type:" + contentType);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ public class ClientChunkEncodedPost {
|
|||
|
||||
final InputStreamEntity reqEntity = new InputStreamEntity(
|
||||
new FileInputStream(file), -1, ContentType.APPLICATION_OCTET_STREAM);
|
||||
reqEntity.setChunked(true);
|
||||
// It may be more appropriate to use FileEntity class in this particular
|
||||
// instance but we are using a more generic InputStreamEntity to demonstrate
|
||||
// the capability to stream out data from any arbitrary source
|
||||
|
|
Loading…
Reference in New Issue