Package org.apache.solr.response
Class ResponseWritersRegistry
java.lang.Object
org.apache.solr.response.ResponseWritersRegistry
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String, QueryResponseWriter> Gets all built-in response writers.static QueryResponseWriterGets a built-in response writer.static QueryResponseWriterGets a response writer, trying the core's registry first, then falling back to built-in writers.static booleanChecks if a writer with the given name exists in the built-in writers.
-
Method Details
-
getWriter
Gets a built-in response writer.Built-in writers are always available and provide essential formats needed by admin APIs and core functionality. They do not depend on core configuration or ImplicitPlugins.json settings.
If the requested writer is not available, returns the JSON writer as a fallback. This ensures requests always get a valid response format.
- Parameters:
writerName- the writer name (e.g., "json", "xml", "javabin"), or null for default- Returns:
- the response writer, never null (returns JSON if not found)
-
getWriter
Gets a response writer, trying the core's registry first, then falling back to built-in writers. This is the unified entry point for all writer resolution.Resolution order:
- If core is provided, check core's writer registry
- If not found in core (or no core), check built-in writers
- If writer name is explicitly specified but not found anywhere, throw exception
- If writer name is null/empty, return default (JSON)
- Parameters:
writerName- the writer name (e.g., "json", "xml", "javabin"), or null for defaultcore- the SolrCore to check first, or null for node-level requests- Returns:
- the response writer, never null
- Throws:
org.apache.solr.common.SolrException- if an explicitly requested writer type is not found
-
hasWriter
Checks if a writer with the given name exists in the built-in writers.- Parameters:
writerName- the writer name to check- Returns:
- true if the writer exists, false otherwise
-
getAllWriters
Gets all built-in response writers.- Returns:
- immutable map of all built-in writers
-