sonatype-lift[bot] commented on code in PR #975:
URL: https://github.com/apache/solr/pull/975#discussion_r957747370


##########
solr/core/src/java/org/apache/solr/jersey/MessageBodyWriters.java:
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.solr.jersey;
+
+import org.apache.solr.common.util.ContentStreamBase;
+import org.apache.solr.common.util.JavaBinCodec;
+import org.apache.solr.handler.api.V2ApiUtils;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.QueryResponseWriterUtil;
+import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.response.XMLResponseWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ResourceContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Type;
+
+import static 
org.apache.solr.jersey.RequestContextConstants.SOLR_QUERY_REQUEST_KEY;
+import static 
org.apache.solr.jersey.RequestContextConstants.SOLR_QUERY_RESPONSE_KEY;
+
+
+public class MessageBodyWriters {
+
+    /**
+     * Registers a JAX-RS {@link MessageBodyWriter} that's used to return a 
javabin response when the request contains
+     * the "Accept: application/javabin" header.
+     */
+    @Produces("application/javabin")
+    public static class JavabinMessageBodyWriter implements 
MessageBodyWriter<JacksonReflectMapWriter> {
+
+        private final JavaBinCodec javaBinCodec;
+
+        public JavabinMessageBodyWriter() {
+            this.javaBinCodec = new JavaBinCodec();
+        }
+
+        @Override
+        public boolean isWriteable(Class<?> type, Type genericType, 
Annotation[] annotations, MediaType mediaType) {
+            return mediaType.equals(new MediaType("application", "javabin"));
+        }
+
+        @Override
+        public void writeTo(JacksonReflectMapWriter reflectMapWriter, Class<?> 
type, Type genericType, Annotation[] annotations, MediaType mediaType, 
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws 
IOException, WebApplicationException {
+            javaBinCodec.marshal(reflectMapWriter, entityStream);
+        }
+    }
+
+    // TODO This pattern should be appropriate for any QueryResponseWriter 
supported elsewhere in Solr.  Write a base
+    //  class to remove all duplication from these content-specific 
implementations.
+    @Produces("application/xml")
+    public static class XmlMessageBodyWriter implements 
MessageBodyWriter<JacksonReflectMapWriter> {
+
+        private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

Review Comment:
   *[UnusedVariable](https://errorprone.info/bugpattern/UnusedVariable):*  The 
field 'log' is never read.
   
   ---
   
   Reply with *"**@sonatype-lift help**"* for info about LiftBot commands.
   Reply with *"**@sonatype-lift ignore**"* to tell LiftBot to leave out the 
above finding from this PR.
   Reply with *"**@sonatype-lift ignoreall**"* to tell LiftBot to leave out all 
the findings from this PR and from the status bar in Github.
   
   When talking to LiftBot, you need to **refresh** the page to see its 
response. [Click here](https://help.sonatype.com/lift/talking-to-lift) to get 
to know more about LiftBot commands.
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not 
relevant](https://www.sonatype.com/lift-comment-rating?comment=323967933&lift_comment_rating=1)
 ] - [ [😕 Won't 
fix](https://www.sonatype.com/lift-comment-rating?comment=323967933&lift_comment_rating=2)
 ] - [ [😑 Not critical, will 
fix](https://www.sonatype.com/lift-comment-rating?comment=323967933&lift_comment_rating=3)
 ] - [ [🙂 Critical, will 
fix](https://www.sonatype.com/lift-comment-rating?comment=323967933&lift_comment_rating=4)
 ] - [ [😊 Critical, fixing 
now](https://www.sonatype.com/lift-comment-rating?comment=323967933&lift_comment_rating=5)
 ]



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to