diff --git a/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java b/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java index 40ab0936488..08d4033b6ae 100644 --- a/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java +++ b/indexing-service/src/main/java/io/druid/indexing/common/actions/RemoteTaskActionClient.java @@ -36,6 +36,7 @@ import io.druid.indexing.common.task.Task; import org.jboss.netty.channel.ChannelException; import org.joda.time.Duration; +import javax.ws.rs.core.MediaType; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -94,7 +95,7 @@ public class RemoteTaskActionClient implements TaskActionClient try { response = httpClient.post(serviceUri.toURL()) - .setContent("application/json", dataToSend) + .setContent(MediaType.APPLICATION_JSON, dataToSend) .go(new StatusResponseHandler(Charsets.UTF_8)) .get(); } diff --git a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java index 9f51d86762d..050a5620856 100644 --- a/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java +++ b/indexing-service/src/main/java/io/druid/indexing/overlord/http/OverlordResource.java @@ -58,6 +58,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.io.InputStream; @@ -100,8 +101,8 @@ public class OverlordResource @POST @Path("/task") - @Consumes("application/json") - @Produces("application/json") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) public Response taskPost(final Task task) { return asLeaderWith( @@ -127,7 +128,7 @@ public class OverlordResource @GET @Path("/task/{taskid}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTaskPayload(@PathParam("taskid") String taskid) { return optionalTaskResponse(taskid, "payload", taskStorageQueryAdapter.getTask(taskid)); @@ -135,7 +136,7 @@ public class OverlordResource @GET @Path("/task/{taskid}/status") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTaskStatus(@PathParam("taskid") String taskid) { return optionalTaskResponse(taskid, "status", taskStorageQueryAdapter.getStatus(taskid)); @@ -143,7 +144,7 @@ public class OverlordResource @GET @Path("/task/{taskid}/segments") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTaskSegments(@PathParam("taskid") String taskid) { final Set segments = taskStorageQueryAdapter.getInsertedSegments(taskid); @@ -152,7 +153,7 @@ public class OverlordResource @POST @Path("/task/{taskid}/shutdown") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response doShutdown(@PathParam("taskid") final String taskid) { return asLeaderWith( @@ -171,7 +172,7 @@ public class OverlordResource @GET @Path("/worker") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getWorkerConfig() { if (workerConfigRef == null) { @@ -183,7 +184,7 @@ public class OverlordResource @POST @Path("/worker") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response setWorkerConfig( final WorkerBehaviorConfig workerBehaviorConfig ) @@ -201,7 +202,7 @@ public class OverlordResource @Deprecated @GET @Path("/worker/setup") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getWorkerSetupData() { if (workerSetupDataRef == null) { @@ -214,7 +215,7 @@ public class OverlordResource @Deprecated @POST @Path("/worker/setup") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response setWorkerSetupData( final WorkerSetupData workerSetupData ) @@ -230,7 +231,7 @@ public class OverlordResource @POST @Path("/action") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response doAction(final TaskActionHolder holder) { return asLeaderWith( @@ -264,7 +265,7 @@ public class OverlordResource @GET @Path("/waitingTasks") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getWaitingTasks() { return workItemsResponse( @@ -311,7 +312,7 @@ public class OverlordResource @GET @Path("/pendingTasks") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getPendingTasks() { return workItemsResponse( @@ -328,7 +329,7 @@ public class OverlordResource @GET @Path("/runningTasks") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getRunningTasks() { return workItemsResponse( @@ -345,7 +346,7 @@ public class OverlordResource @GET @Path("/completeTasks") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getCompleteTasks() { final List completeTasks = Lists.transform( @@ -370,7 +371,7 @@ public class OverlordResource @GET @Path("/workers") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getWorkers() { return asLeaderWith( @@ -388,7 +389,7 @@ public class OverlordResource @GET @Path("/scaling") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getScalingState() { // Don't use asLeaderWith, since we want to return 200 instead of 503 when missing an autoscaler. diff --git a/indexing-service/src/main/java/io/druid/indexing/worker/http/WorkerResource.java b/indexing-service/src/main/java/io/druid/indexing/worker/http/WorkerResource.java index 1bf4936f8e0..dbecb5361c3 100644 --- a/indexing-service/src/main/java/io/druid/indexing/worker/http/WorkerResource.java +++ b/indexing-service/src/main/java/io/druid/indexing/worker/http/WorkerResource.java @@ -39,6 +39,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.InputStream; @@ -72,7 +73,7 @@ public class WorkerResource @POST @Path("/disable") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response doDisable() { try { @@ -86,7 +87,7 @@ public class WorkerResource @POST @Path("/enable") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response doEnable() { try { @@ -100,7 +101,7 @@ public class WorkerResource @GET @Path("/enabled") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response isEnabled() { try { @@ -115,7 +116,7 @@ public class WorkerResource @GET @Path("/tasks") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTasks() { try { @@ -142,7 +143,7 @@ public class WorkerResource @POST @Path("/task/{taskid}/shutdown") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response doShutdown(@PathParam("taskid") String taskid) { try { diff --git a/server/src/main/java/io/druid/client/indexing/IndexingServiceClient.java b/server/src/main/java/io/druid/client/indexing/IndexingServiceClient.java index c345bdb2669..07114c247f1 100644 --- a/server/src/main/java/io/druid/client/indexing/IndexingServiceClient.java +++ b/server/src/main/java/io/druid/client/indexing/IndexingServiceClient.java @@ -32,6 +32,7 @@ import io.druid.guice.annotations.Global; import io.druid.timeline.DataSegment; import org.joda.time.Interval; +import javax.ws.rs.core.MediaType; import java.io.InputStream; import java.net.URL; import java.util.Iterator; @@ -94,7 +95,7 @@ public class IndexingServiceClient { try { return client.post(new URL(String.format("%s/task", baseUrl()))) - .setContent("application/json", jsonMapper.writeValueAsBytes(queryObject)) + .setContent(MediaType.APPLICATION_JSON, jsonMapper.writeValueAsBytes(queryObject)) .go(RESPONSE_HANDLER) .get(); } diff --git a/server/src/main/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java b/server/src/main/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java index 80de1c3b152..c791c41324e 100644 --- a/server/src/main/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java +++ b/server/src/main/java/io/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java @@ -38,6 +38,7 @@ import io.druid.data.input.impl.MapInputRowParser; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.Collection; @@ -125,7 +126,7 @@ public class EventReceiverFirehoseFactory implements FirehoseFactory> events) { log.debug("Adding %,d events to firehose: %s", events.size(), serviceName); diff --git a/server/src/main/java/io/druid/server/ClientInfoResource.java b/server/src/main/java/io/druid/server/ClientInfoResource.java index cbd253525bb..2018611f9d7 100644 --- a/server/src/main/java/io/druid/server/ClientInfoResource.java +++ b/server/src/main/java/io/druid/server/ClientInfoResource.java @@ -36,6 +36,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.Set; @@ -73,7 +74,7 @@ public class ClientInfoResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Iterable getDataSources() { return getSegmentsForDatasources().keySet(); @@ -81,7 +82,7 @@ public class ClientInfoResource @GET @Path("/{dataSourceName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Map getDatasource( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") String interval @@ -95,7 +96,7 @@ public class ClientInfoResource @GET @Path("/{dataSourceName}/dimensions") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Iterable getDatasourceDimensions( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") String interval @@ -127,7 +128,7 @@ public class ClientInfoResource @GET @Path("/{dataSourceName}/metrics") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Iterable getDatasourceMetrics( @PathParam("dataSourceName") String dataSourceName, @QueryParam("interval") String interval diff --git a/server/src/main/java/io/druid/server/StatusResource.java b/server/src/main/java/io/druid/server/StatusResource.java index 44aa50a0ee7..10fccf383ab 100644 --- a/server/src/main/java/io/druid/server/StatusResource.java +++ b/server/src/main/java/io/druid/server/StatusResource.java @@ -27,6 +27,7 @@ import io.druid.initialization.Initialization; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -37,7 +38,7 @@ import java.util.List; public class StatusResource { @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Status doGet() { return new Status(Initialization.getLoadedModules(DruidModule.class)); diff --git a/server/src/main/java/io/druid/server/bridge/BridgeQuerySegmentWalker.java b/server/src/main/java/io/druid/server/bridge/BridgeQuerySegmentWalker.java index ee17781d5ac..dcc825758bc 100644 --- a/server/src/main/java/io/druid/server/bridge/BridgeQuerySegmentWalker.java +++ b/server/src/main/java/io/druid/server/bridge/BridgeQuerySegmentWalker.java @@ -38,6 +38,7 @@ import io.druid.query.QuerySegmentWalker; import io.druid.query.SegmentDescriptor; import org.joda.time.Interval; +import javax.ws.rs.core.MediaType; import java.net.URL; import java.util.List; import java.util.Map; @@ -102,7 +103,7 @@ public class BridgeQuerySegmentWalker implements QuerySegmentWalker StatusResponseHolder response = httpClient.post(new URL(url)) .setContent( - "application/json", + MediaType.APPLICATION_JSON, jsonMapper.writeValueAsBytes(query) ) .go(responseHandler) diff --git a/server/src/main/java/io/druid/server/http/CoordinatorDynamicConfigsResource.java b/server/src/main/java/io/druid/server/http/CoordinatorDynamicConfigsResource.java index 675818122e6..11b1ba4e5be 100644 --- a/server/src/main/java/io/druid/server/http/CoordinatorDynamicConfigsResource.java +++ b/server/src/main/java/io/druid/server/http/CoordinatorDynamicConfigsResource.java @@ -28,6 +28,7 @@ import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** @@ -46,7 +47,7 @@ public class CoordinatorDynamicConfigsResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDynamicConfigs() { return Response.ok( @@ -58,7 +59,7 @@ public class CoordinatorDynamicConfigsResource } @POST - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response setDynamicConfigs(final CoordinatorDynamicConfig dynamicConfig) { if (!manager.set(CoordinatorDynamicConfig.CONFIG_KEY, dynamicConfig)) { diff --git a/server/src/main/java/io/druid/server/http/CoordinatorResource.java b/server/src/main/java/io/druid/server/http/CoordinatorResource.java index 6fbff039707..e661d31b17f 100644 --- a/server/src/main/java/io/druid/server/http/CoordinatorResource.java +++ b/server/src/main/java/io/druid/server/http/CoordinatorResource.java @@ -32,6 +32,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** @@ -51,7 +52,7 @@ public class CoordinatorResource @GET @Path("/leader") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getLeader() { return Response.ok(coordinator.getCurrentLeader()).build(); @@ -59,7 +60,7 @@ public class CoordinatorResource @GET @Path("/loadstatus") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getLoadStatus( @QueryParam("simple") String simple, @QueryParam("full") String full @@ -77,7 +78,7 @@ public class CoordinatorResource @GET @Path("/loadqueue") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getLoadQueue( @QueryParam("simple") String simple, @QueryParam("full") String full diff --git a/server/src/main/java/io/druid/server/http/DatasourcesResource.java b/server/src/main/java/io/druid/server/http/DatasourcesResource.java index cb44dad8338..6d88f1d8eae 100644 --- a/server/src/main/java/io/druid/server/http/DatasourcesResource.java +++ b/server/src/main/java/io/druid/server/http/DatasourcesResource.java @@ -47,6 +47,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Comparator; import java.util.List; @@ -76,7 +77,7 @@ public class DatasourcesResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getQueryableDataSources( @QueryParam("full") String full, @QueryParam("simple") String simple @@ -122,7 +123,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTheDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("full") final String full @@ -142,7 +143,7 @@ public class DatasourcesResource @POST @Path("/{dataSourceName}") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response enableDataSource( @PathParam("dataSourceName") final String dataSourceName ) @@ -156,7 +157,7 @@ public class DatasourcesResource @DELETE @Path("/{dataSourceName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response deleteDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("kill") final String kill, @@ -190,7 +191,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}/intervals") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getSegmentDataSourceIntervals( @PathParam("dataSourceName") String dataSourceName, @QueryParam("simple") String simple, @@ -250,7 +251,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}/intervals/{interval}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getSegmentDataSourceSpecificInterval( @PathParam("dataSourceName") String dataSourceName, @PathParam("interval") String interval, @@ -317,7 +318,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}/segments") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getSegmentDataSourceSegments( @PathParam("dataSourceName") String dataSourceName, @QueryParam("full") String full @@ -350,7 +351,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}/segments/{segmentId}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getSegmentDataSourceSegment( @PathParam("dataSourceName") String dataSourceName, @PathParam("segmentId") String segmentId @@ -388,7 +389,7 @@ public class DatasourcesResource @POST @Path("/{dataSourceName}/segments/{segmentId}") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response enableDatasourceSegment( @PathParam("dataSourceName") String dataSourceName, @PathParam("segmentId") String segmentId @@ -403,7 +404,7 @@ public class DatasourcesResource @GET @Path("/{dataSourceName}/tiers") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getSegmentDataSourceTiers( @PathParam("dataSourceName") String dataSourceName ) diff --git a/server/src/main/java/io/druid/server/http/HistoricalResource.java b/server/src/main/java/io/druid/server/http/HistoricalResource.java index a4f5956a0cc..f5326919fcf 100644 --- a/server/src/main/java/io/druid/server/http/HistoricalResource.java +++ b/server/src/main/java/io/druid/server/http/HistoricalResource.java @@ -7,6 +7,7 @@ import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("/druid/historical/v1") @@ -24,7 +25,7 @@ public class HistoricalResource @GET @Path("/loadstatus") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getLoadStatus() { return Response.ok(ImmutableMap.of("cacheInitialized", coordinator.isStarted())).build(); diff --git a/server/src/main/java/io/druid/server/http/MetadataResource.java b/server/src/main/java/io/druid/server/http/MetadataResource.java index b14b341e2ce..f9d51e5194e 100644 --- a/server/src/main/java/io/druid/server/http/MetadataResource.java +++ b/server/src/main/java/io/druid/server/http/MetadataResource.java @@ -32,6 +32,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Collections; import java.util.List; @@ -53,7 +54,7 @@ public class MetadataResource @GET @Path("/datasources") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDatabaseDataSources( @QueryParam("full") String full, @QueryParam("includeDisabled") String includeDisabled @@ -88,7 +89,7 @@ public class MetadataResource @GET @Path("/datasources/{dataSourceName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDatabaseSegmentDataSource( @PathParam("dataSourceName") final String dataSourceName ) @@ -103,7 +104,7 @@ public class MetadataResource @GET @Path("/datasources/{dataSourceName}/segments") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDatabaseSegmentDataSourceSegments( @PathParam("dataSourceName") String dataSourceName, @QueryParam("full") String full @@ -136,7 +137,7 @@ public class MetadataResource @GET @Path("/datasources/{dataSourceName}/segments/{segmentId}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDatabaseSegmentDataSourceSegment( @PathParam("dataSourceName") String dataSourceName, @PathParam("segmentId") String segmentId diff --git a/server/src/main/java/io/druid/server/http/RulesResource.java b/server/src/main/java/io/druid/server/http/RulesResource.java index 03996463077..31dd63d4593 100644 --- a/server/src/main/java/io/druid/server/http/RulesResource.java +++ b/server/src/main/java/io/druid/server/http/RulesResource.java @@ -30,6 +30,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -49,7 +50,7 @@ public class RulesResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getRules() { return Response.ok(databaseRuleManager.getAllRules()).build(); @@ -57,7 +58,7 @@ public class RulesResource @GET @Path("/{dataSourceName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getDatasourceRules( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("full") final String full @@ -74,7 +75,7 @@ public class RulesResource @POST @Path("/{dataSourceName}") - @Consumes("application/json") + @Consumes(MediaType.APPLICATION_JSON) public Response setDatasourceRules( @PathParam("dataSourceName") final String dataSourceName, final List rules diff --git a/server/src/main/java/io/druid/server/http/ServersResource.java b/server/src/main/java/io/druid/server/http/ServersResource.java index 3a7b325d202..cd51f4d5c44 100644 --- a/server/src/main/java/io/druid/server/http/ServersResource.java +++ b/server/src/main/java/io/druid/server/http/ServersResource.java @@ -35,6 +35,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Map; @@ -66,7 +67,7 @@ public class ServersResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getClusterServers( @QueryParam("full") String full, @QueryParam("simple") String simple @@ -113,7 +114,7 @@ public class ServersResource @GET @Path("/{serverName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getServer( @PathParam("serverName") String serverName, @QueryParam("simple") String simple @@ -136,7 +137,7 @@ public class ServersResource @GET @Path("/{serverName}/segments") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getServerSegments( @PathParam("serverName") String serverName, @QueryParam("full") String full @@ -169,7 +170,7 @@ public class ServersResource @GET @Path("/{serverName}/segments/{segmentId}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getServerSegment( @PathParam("serverName") String serverName, @PathParam("segmentId") String segmentId diff --git a/server/src/main/java/io/druid/server/http/TiersResource.java b/server/src/main/java/io/druid/server/http/TiersResource.java index 97810a7cd70..b90a5d5b4a7 100644 --- a/server/src/main/java/io/druid/server/http/TiersResource.java +++ b/server/src/main/java/io/druid/server/http/TiersResource.java @@ -39,6 +39,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Map; import java.util.Set; @@ -59,7 +60,7 @@ public class TiersResource } @GET - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTiers( @QueryParam("simple") String simple ) @@ -95,7 +96,7 @@ public class TiersResource @GET @Path("/{tierName}") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response getTierDatasources( @PathParam("tierName") String tierName, @QueryParam("simple") String simple diff --git a/server/src/main/java/io/druid/server/sql/SQLRunner.java b/server/src/main/java/io/druid/server/sql/SQLRunner.java index ca16426721f..2fde8adb8bd 100644 --- a/server/src/main/java/io/druid/server/sql/SQLRunner.java +++ b/server/src/main/java/io/druid/server/sql/SQLRunner.java @@ -50,6 +50,7 @@ import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import javax.annotation.Nullable; +import javax.ws.rs.core.MediaType; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; @@ -143,7 +144,7 @@ public class SQLRunner URL url = new URL(String.format("http://%s/druid/v2/?pretty", hostname)); final URLConnection urlConnection = url.openConnection(); - urlConnection.addRequestProperty("content-type", "application/json"); + urlConnection.addRequestProperty("content-type", MediaType.APPLICATION_JSON); urlConnection.getOutputStream().write(queryStr.getBytes(Charsets.UTF_8)); BufferedReader stdInput = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), Charsets.UTF_8)); diff --git a/server/src/test/java/io/druid/server/initialization/JettyTest.java b/server/src/test/java/io/druid/server/initialization/JettyTest.java index 710844d4d5d..917a9abfdb0 100644 --- a/server/src/test/java/io/druid/server/initialization/JettyTest.java +++ b/server/src/test/java/io/druid/server/initialization/JettyTest.java @@ -63,6 +63,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.io.InputStream; @@ -275,7 +276,7 @@ public class JettyTest @GET @Path("/hello") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response hello() { try { @@ -293,7 +294,7 @@ public class JettyTest { @GET @Path("/exception") - @Produces("application/json") + @Produces(MediaType.APPLICATION_JSON) public Response exception( @Context HttpServletResponse resp ) throws IOException