epugh commented on code in PR #4073: URL: https://github.com/apache/solr/pull/4073#discussion_r2725559793
########## solr/core/src/java/org/apache/solr/response/BuiltInResponseWriters.java: ########## @@ -0,0 +1,96 @@ +/* + * 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.response; + +import static org.apache.solr.handler.admin.MetricsHandler.OPEN_METRICS_WT; +import static org.apache.solr.handler.admin.MetricsHandler.PROMETHEUS_METRICS_WT; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.apache.solr.common.params.CommonParams; + +/** + * Registry for built-in response writers in Solr. + * + * <p>Manages a minimal set of essential response writers that are always available, regardless of + * core configuration or ImplicitPlugins.json settings. These writers are primarily used by + * admin/container-level requests that have no associated SolrCore. + * + * <p>Built-in writers include essential formats needed by admin APIs and core functionality: + * javabin, json, xml, prometheus, and openmetrics. + * + * <p>For core-specific requests that need access to the full set of response writers (including + * csv, geojson, graphml, smile, etc.), use the SolrCore's response writer registry which is loaded + * from ImplicitPlugins.json and supports ConfigOverlay customizations. + */ +public class BuiltInResponseWriters { + + private BuiltInResponseWriters() { + // Prevent instantiation + } + + /** + * Built-in response writers that are always available. + * + * <p>Contains only essential formats needed by admin APIs and core functionality: + * + * <ul> + * <li><b>javabin</b> - Binary format, efficient for SolrJ clients + * <li><b>json/standard</b> - JSON format, default for most requests + * <li><b>xml</b> - XML format, provides backward compatibility + * <li><b>prometheus/openmetrics</b> - Required by metrics endpoints + * </ul> + */ + private static final Map<String, QueryResponseWriter> BUILTIN_WRITERS; + + static { + // Initialize built-in writers that are always available + Map<String, QueryResponseWriter> builtinWriters = new HashMap<>(6, 1); + builtinWriters.put(CommonParams.JAVABIN, new JavaBinResponseWriter()); + builtinWriters.put(CommonParams.JSON, new JacksonJsonWriter()); + builtinWriters.put("standard", builtinWriters.get(CommonParams.JSON)); // Alias for JSON Review Comment: https://issues.apache.org/jira/browse/SOLR-18085 for this. I will remove my ranting about this from this PR now that we have a plan and a JIRA. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
