Search in sources :

Example 1 with Part

use of com.opentext.ia.sdk.support.http.Part in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class ApacheHttpClient method post.

@Override
public <T> T post(String uri, Collection<Header> headers, Class<T> type, Part... parts) throws IOException {
    HttpPost request = newPost(uri, headers);
    MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
    for (Part part : parts) {
        entityBuilder.addPart(part.getName(), newContentBody(part));
    }
    request.setEntity(entityBuilder.build());
    return execute(request, type);
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) TextPart(com.opentext.ia.sdk.support.http.TextPart) BinaryPart(com.opentext.ia.sdk.support.http.BinaryPart) Part(com.opentext.ia.sdk.support.http.Part)

Example 2 with Part

use of com.opentext.ia.sdk.support.http.Part in project infoarchive-sip-sdk by Enterprise-Content-Management.

the class ApacheHttpClient method put.

@Override
public <T> T put(String uri, Collection<Header> headers, Class<T> type, Part... parts) throws IOException {
    HttpPut request = newPut(uri, headers);
    MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
    for (Part part : parts) {
        entityBuilder.addPart(part.getName(), newContentBody(part));
    }
    request.setEntity(entityBuilder.build());
    return execute(request, type);
}
Also used : MultipartEntityBuilder(org.apache.http.entity.mime.MultipartEntityBuilder) TextPart(com.opentext.ia.sdk.support.http.TextPart) BinaryPart(com.opentext.ia.sdk.support.http.BinaryPart) Part(com.opentext.ia.sdk.support.http.Part) HttpPut(org.apache.http.client.methods.HttpPut)

Aggregations

BinaryPart (com.opentext.ia.sdk.support.http.BinaryPart)2 Part (com.opentext.ia.sdk.support.http.Part)2 TextPart (com.opentext.ia.sdk.support.http.TextPart)2 MultipartEntityBuilder (org.apache.http.entity.mime.MultipartEntityBuilder)2 HttpPost (org.apache.http.client.methods.HttpPost)1 HttpPut (org.apache.http.client.methods.HttpPut)1