Add smile provider (#2951)

This commit is contained in:
Charles Allen 2016-05-10 16:03:39 -07:00 committed by Fangjin Yang
parent 2288c78395
commit 6332bd70f4
1 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package io.druid.server.initialization.jetty;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import com.fasterxml.jackson.jaxrs.smile.JacksonSmileProvider;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
@ -50,6 +51,7 @@ import io.druid.guice.LazySingleton;
import io.druid.guice.annotations.JSR311Resource; import io.druid.guice.annotations.JSR311Resource;
import io.druid.guice.annotations.Json; import io.druid.guice.annotations.Json;
import io.druid.guice.annotations.Self; import io.druid.guice.annotations.Self;
import io.druid.guice.annotations.Smile;
import io.druid.query.DruidMetrics; import io.druid.query.DruidMetrics;
import io.druid.server.DruidNode; import io.druid.server.DruidNode;
import io.druid.server.StatusResource; import io.druid.server.StatusResource;
@ -145,6 +147,15 @@ public class JettyServerModule extends JerseyServletModule
return provider; return provider;
} }
@Provides
@Singleton
public JacksonSmileProvider getJacksonSmileProvider(@Smile ObjectMapper objectMapper)
{
final JacksonSmileProvider provider = new JacksonSmileProvider();
provider.setMapper(objectMapper);
return provider;
}
static Server makeJettyServer(DruidNode node, ServerConfig config) static Server makeJettyServer(DruidNode node, ServerConfig config)
{ {
final QueuedThreadPool threadPool = new QueuedThreadPool(); final QueuedThreadPool threadPool = new QueuedThreadPool();