use of com.canoo.dp.impl.platform.core.http.HttpHeaderImpl in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readString.
@Override
public Promise<HttpResponse<String>, HttpException> readString() {
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_CHARSET_HEADER, CHARSET));
final ResponseContentConverter<String> converter = b -> new String(b, CHARSET);
return createExecutor(converter);
}
use of com.canoo.dp.impl.platform.core.http.HttpHeaderImpl in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readBytes.
@Override
public Promise<HttpResponse<ByteArrayProvider>, HttpException> readBytes(final String contentType) {
Assert.requireNonNull(contentType, "contentType");
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_HEADER, contentType));
return readBytes();
}
use of com.canoo.dp.impl.platform.core.http.HttpHeaderImpl in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readString.
@Override
public Promise<HttpResponse<String>, HttpException> readString(final String contentType) {
Assert.requireNonNull(contentType, "contentType");
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_HEADER, contentType));
return readString();
}
use of com.canoo.dp.impl.platform.core.http.HttpHeaderImpl in project dolphin-platform by canoo.
the class HttpCallResponseBuilderImpl method readObject.
@Override
public <R> Promise<HttpResponse<R>, HttpException> readObject(final Class<R> responseType) {
Assert.requireNonNull(responseType, "responseType");
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_CHARSET_HEADER, CHARSET));
connection.addRequestHeader(new HttpHeaderImpl(ACCEPT_HEADER, JSON_MIME_TYPE));
final ResponseContentConverter<R> converter = b -> gson.fromJson(new String(b, CHARSET), responseType);
return createExecutor(converter);
}
Aggregations