esevastyanov commented on a change in pull request #8110: Response context 
refactoring
URL: https://github.com/apache/incubator-druid/pull/8110#discussion_r306280663
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/QueryResource.java
 ##########
 @@ -241,28 +248,28 @@ public void write(OutputStream outputStream) throws 
WebApplicationException
                     }
                   }
                 },
-                context.getContentType()
+                ioReaderWriter.getContentType()
             )
             .header("X-Druid-Query-Id", queryId);
 
-        if (responseContext.get(HEADER_ETAG) != null) {
-          builder.header(HEADER_ETAG, responseContext.get(HEADER_ETAG));
-          responseContext.remove(HEADER_ETAG);
+        if (responseContext.get(ResponseContext.CTX_ETAG) != null) {
+          builder.header(HEADER_ETAG, 
responseContext.get(ResponseContext.CTX_ETAG));
+          responseContext.remove(ResponseContext.CTX_ETAG);
         }
 
         DirectDruidClient.removeMagicResponseContextFields(responseContext);
 
         //Limit the response-context header, see 
https://github.com/apache/incubator-druid/issues/2331
         //Note that Response.ResponseBuilder.header(String key,Object 
value).build() calls value.toString()
         //and encodes the string using ASCII, so 1 char is = 1 byte
-        String responseCtxString = 
jsonMapper.writeValueAsString(responseContext);
+        String responseCtxString = responseContext.serialize(jsonMapper);
 
 Review comment:
   renamed the method

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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]

Reply via email to