leventov closed pull request #6709: add charset UTF-8 to log api
URL: https://github.com/apache/incubator-druid/pull/6709
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml
index eebbc5888dc..163c53a0388 100644
--- a/codestyle/checkstyle.xml
+++ b/codestyle/checkstyle.xml
@@ -194,6 +194,12 @@
<property name="message" value="Use
org.apache.druid.common.config.NullHandling.nullToEmptyIfNeeded instead"/>
</module>
+ <module name="Regexp">
+ <property name="format" value='@Produces\(\"text/plain\"\)'/>
+ <property name="illegalPattern" value="true"/>
+ <property name="message" value="Use
org.apache.druid.server.http.HttpMediaType#TEXT_PLAIN_UTF8 instead"/>
+ </module>
+
<module name="PackageName">
<property name="format" value="^org.apache.druid.*$"/>
</module>
diff --git
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java
index ebbb1cfb1f5..767e71d8682 100644
---
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java
+++
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java
@@ -59,6 +59,7 @@
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.metadata.EntryExistsException;
+import org.apache.druid.server.http.HttpMediaType;
import org.apache.druid.server.http.security.ConfigResourceFilter;
import org.apache.druid.server.http.security.StateResourceFilter;
import org.apache.druid.server.security.Access;
@@ -949,7 +950,7 @@ public Response getScalingState()
@GET
@Path("/task/{taskid}/log")
- @Produces("text/plain")
+ @Produces(HttpMediaType.TEXT_PLAIN_UTF8)
@ResourceFilters(TaskResourceFilter.class)
public Response doGetLog(
@PathParam("taskid") final String taskid,
diff --git
a/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java
b/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java
index d37b2bf06f2..bfe7deef6fe 100644
---
a/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java
+++
b/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java
@@ -34,6 +34,7 @@
import org.apache.druid.indexing.worker.WorkerTaskMonitor;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.server.http.HttpMediaType;
import org.apache.druid.server.http.security.ConfigResourceFilter;
import org.apache.druid.server.http.security.StateResourceFilter;
import org.apache.druid.tasklogs.TaskLogStreamer;
@@ -179,7 +180,7 @@ public Response doShutdown(@PathParam("taskid") String
taskid)
@GET
@Path("/task/{taskid}/log")
- @Produces("text/plain")
+ @Produces(HttpMediaType.TEXT_PLAIN_UTF8)
@ResourceFilters(StateResourceFilter.class)
public Response doGetLog(
@PathParam("taskid") String taskid,
diff --git
a/server/src/main/java/org/apache/druid/server/http/HttpMediaType.java
b/server/src/main/java/org/apache/druid/server/http/HttpMediaType.java
new file mode 100644
index 00000000000..6f69c3a7d59
--- /dev/null
+++ b/server/src/main/java/org/apache/druid/server/http/HttpMediaType.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.server.http;
+
+import javax.ws.rs.core.MediaType;
+
+public class HttpMediaType
+{
+ public static final String TEXT_PLAIN_UTF8 = MediaType.TEXT_PLAIN + ";
charset=UTF-8";
+}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]