From 4246046d07396022f3cb7e284a058df58b173fc0 Mon Sep 17 00:00:00 2001 From: Allen Wang Date: Wed, 8 Jan 2014 16:36:20 -0800 Subject: [PATCH] added missing class --- .../com/netflix/client/http/HttpUtils.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ribbon-core/src/main/java/com/netflix/client/http/HttpUtils.java diff --git a/ribbon-core/src/main/java/com/netflix/client/http/HttpUtils.java b/ribbon-core/src/main/java/com/netflix/client/http/HttpUtils.java new file mode 100644 index 0000000..5405001 --- /dev/null +++ b/ribbon-core/src/main/java/com/netflix/client/http/HttpUtils.java @@ -0,0 +1,22 @@ +package com.netflix.client.http; + +import java.io.IOException; + +import com.netflix.serialization.ContentTypeBasedSerializerKey; +import com.netflix.serialization.Deserializer; +import com.netflix.serialization.SerializationFactory; +import com.netflix.serialization.TypeDef; + +public class HttpUtils { + + public static T getEntity(HttpResponse response, TypeDef type, Deserializer deserializer) throws IOException { + return deserializer.deserialize(response.getInputStream(), type); + } + + public static T getEntity(HttpResponse response, TypeDef type, + SerializationFactory serializationFactory) throws IOException { + String contentType = response.getHttpHeaders().getFirst("Content-Type"); + Deserializer deserializer = serializationFactory.getDeserializer(new ContentTypeBasedSerializerKey(contentType, type)); + return deserializer.deserialize(response.getInputStream(), type); + } +} -- GitLab