Search in sources :

Example 1 with ACCEPT_HEADER

use of com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_HEADER 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);
}
Also used : HttpHeaderImpl(com.canoo.dp.impl.platform.core.http.HttpHeaderImpl) ByteArrayProvider(com.canoo.platform.core.http.ByteArrayProvider) HttpException(com.canoo.platform.core.http.HttpException) Assert(com.canoo.dp.impl.platform.core.Assert) ConnectionException(com.canoo.platform.core.http.ConnectionException) HttpResponse(com.canoo.platform.core.http.HttpResponse) HttpClientConnection(com.canoo.dp.impl.platform.core.http.HttpClientConnection) HttpHeader(com.canoo.platform.core.http.HttpHeader) HttpCallResponseBuilder(com.canoo.platform.core.http.HttpCallResponseBuilder) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IOException(java.io.IOException) CHARSET(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.CHARSET) API(org.apiguardian.api.API) INTERNAL(org.apiguardian.api.API.Status.INTERNAL) DolphinRuntimeException(com.canoo.platform.core.DolphinRuntimeException) Promise(com.canoo.platform.core.functional.Promise) List(java.util.List) ACCEPT_CHARSET_HEADER(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_CHARSET_HEADER) HttpURLConnectionHandler(com.canoo.platform.core.http.HttpURLConnectionHandler) Gson(com.google.gson.Gson) JSON_MIME_TYPE(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.JSON_MIME_TYPE) Collections(java.util.Collections) ClientConfiguration(com.canoo.platform.client.ClientConfiguration) ACCEPT_HEADER(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_HEADER) ACCEPT_CHARSET_HEADER(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_CHARSET_HEADER) ACCEPT_HEADER(com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_HEADER) HttpHeaderImpl(com.canoo.dp.impl.platform.core.http.HttpHeaderImpl)

Aggregations

Assert (com.canoo.dp.impl.platform.core.Assert)1 HttpClientConnection (com.canoo.dp.impl.platform.core.http.HttpClientConnection)1 ACCEPT_CHARSET_HEADER (com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_CHARSET_HEADER)1 ACCEPT_HEADER (com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.ACCEPT_HEADER)1 CHARSET (com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.CHARSET)1 JSON_MIME_TYPE (com.canoo.dp.impl.platform.core.http.HttpHeaderConstants.JSON_MIME_TYPE)1 HttpHeaderImpl (com.canoo.dp.impl.platform.core.http.HttpHeaderImpl)1 ClientConfiguration (com.canoo.platform.client.ClientConfiguration)1 DolphinRuntimeException (com.canoo.platform.core.DolphinRuntimeException)1 Promise (com.canoo.platform.core.functional.Promise)1 ByteArrayProvider (com.canoo.platform.core.http.ByteArrayProvider)1 ConnectionException (com.canoo.platform.core.http.ConnectionException)1 HttpCallResponseBuilder (com.canoo.platform.core.http.HttpCallResponseBuilder)1 HttpException (com.canoo.platform.core.http.HttpException)1 HttpHeader (com.canoo.platform.core.http.HttpHeader)1 HttpResponse (com.canoo.platform.core.http.HttpResponse)1 HttpURLConnectionHandler (com.canoo.platform.core.http.HttpURLConnectionHandler)1 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1