- All Superinterfaces:
- All Known Subinterfaces:
- All Known Implementing Classes:
public interface QueryResponseWriter extends NamedListInitializedPluginImplementations of
QueryResponseWriterare used to format responses to query requests. Different
QueryResponseWriters are registered with the
SolrCore. One way to register a QueryResponseWriter with the core is through the
solrconfig.xmlentry to register a
QueryResponseWriterimplementation to handle all queries with a writer type of "simple":
<queryResponseWriter name="simple" class="foo.SimpleResponseWriter" />
A single instance of any registered QueryResponseWriter is created via the default constructor and is reused for all relevant queries.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
getContentType(SolrQueryRequest request, SolrQueryResponse response)Return the applicable Content Type for a request, this method must be thread safe.
initwill be called just once, immediately after creation.
write(Writer writer, SolrQueryRequest request, SolrQueryResponse response)Write a SolrQueryResponse, this method must be thread save.
void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOExceptionWrite a SolrQueryResponse, this method must be thread save.
Information about the request (in particular: formatting options) may be obtained from
reqbut the dominant source of information should be
There are no mandatory actions that write must perform. An empty write implementation would fulfill all interface obligations.
String getContentType(SolrQueryRequest request, SolrQueryResponse response)Return the applicable Content Type for a request, this method must be thread safe.
QueryResponseWriter's must implement this method to return a valid HTTP Content-Type header for the request, that will logically correspond with the output produced by the write method.
- a Content-Type string, which may not be null.