gerlowskija commented on code in PR #975: URL: https://github.com/apache/solr/pull/975#discussion_r966177196
########## solr/core/src/java/org/apache/solr/jersey/MessageBodyWriters.java: ########## @@ -0,0 +1,133 @@ +/* + * 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 static org.apache.solr.jersey.RequestContextConstants.SOLR_QUERY_REQUEST_KEY; +import static org.apache.solr.jersey.RequestContextConstants.SOLR_QUERY_RESPONSE_KEY; +import static org.apache.solr.response.QueryResponseWriter.CONTENT_TYPE_TEXT_UTF8; + +import java.io.IOException; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +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 org.apache.solr.handler.api.V2ApiUtils; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.BinaryResponseWriter; +import org.apache.solr.response.CSVResponseWriter; +import org.apache.solr.response.QueryResponseWriter; +import org.apache.solr.response.QueryResponseWriterUtil; +import org.apache.solr.response.SolrQueryResponse; +import org.apache.solr.response.XMLResponseWriter; + +/** + * A collection of thin Jersey shims around Solr's existing {@link QueryResponseWriter} interface + */ +public class MessageBodyWriters { + + // Jersey has a default MessageBodyWriter for JSON so we don't need to declare one here + // Which other response-writer formats are worth carrying forward into v2? + + @Produces(MediaType.APPLICATION_XML) + public static class XmlMessageBodyWriter extends BaseMessageBodyWriter + implements MessageBodyWriter<JacksonReflectMapWriter> { + @Override + public QueryResponseWriter createResponseWriter() { + return new XMLResponseWriter(); + } + + @Override + public String getSupportedMediaType() { + return MediaType.APPLICATION_XML; + } + } + + @Produces("application/javabin") Review Comment: Fixed in a recent addition; more details on Jan's original thread. -- 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