QueryResponseWriter (Solr 3.6.2 API)
Keywords: org.apache.solr.response.QueryResponseWriter interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.response
Interface QueryResponseWriter

All Superinterfaces:
  NamedListInitializedPlugin

All Known Subinterfaces:
  BinaryQueryResponseWriter, BinaryQueryResponseWriter, QueryResponseWriter

All Known Implementing Classes:
  BinaryResponseWriter, BinaryResponseWriter, CSVResponseWriter, GenericBinaryResponseWriter, GenericTextResponseWriter, JSONResponseWriter, JSONResponseWriter, PHPResponseWriter, PHPResponseWriter, PHPSerializedResponseWriter, PHPSerializedResponseWriter, PythonResponseWriter, PythonResponseWriter, RawResponseWriter, RawResponseWriter, RubyResponseWriter, RubyResponseWriter, SolrCore.LazyQueryResponseWriterWrapper, XMLResponseWriter, XMLResponseWriter, XSLTResponseWriter, XSLTResponseWriter

    public interface QueryResponseWriter

extends NamedListInitializedPlugin

Implementations of `QueryResponseWriter` are used to format responses to query requests. Different `QueryResponseWriter`s are registered with the `SolrCore`. One way to register a QueryResponseWriter with the core is through the `solrconfig.xml` file.

Example `solrconfig.xml` entry to register a `QueryResponseWriter` implementation 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.

Version:
  $Id: QueryResponseWriter.java 1075192 2011-02-28 00:50:09Z uschindler $

Field Summary
`static String` | `CONTENT_TYPE_TEXT_ASCII`
`static String` | `CONTENT_TYPE_TEXT_UTF8`
`static String` | `CONTENT_TYPE_XML_UTF8`

Method Summary
`String` | `getContentType(SolrQueryRequest request, SolrQueryResponse response)` Return the applicable Content Type for a request, this method must be thread safe.
`void` | `init(NamedList args)` `init` will be called just once, immediately after creation.
`void` | `write(Writer writer, SolrQueryRequest request, SolrQueryResponse response)` Write a SolrQueryResponse, this method must be thread save.

Field Detail

### CONTENT_TYPE_XML_UTF8

    static final String CONTENT_TYPE_XML_UTF8

See Also:
  Constant Field Values

### CONTENT_TYPE_TEXT_UTF8

    static final String CONTENT_TYPE_TEXT_UTF8

See Also:
  Constant Field Values

### CONTENT_TYPE_TEXT_ASCII

    static final String CONTENT_TYPE_TEXT_ASCII

See Also:
  Constant Field Values

Method Detail

### write

    void write(Writer writer,
               SolrQueryRequest request,
               SolrQueryResponse response)
               throws IOException

  Write a SolrQueryResponse, this method must be thread save.

  Information about the request (in particular: formating options) may be obtained from `req` but the dominant source of information should be `rsp`.

  There are no mandatory actions that write must perform. An empty write implementation would fulfill all interface obligations.

  Throws:
    `IOException`

### getContentType

    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.

  Returns:
    a Content-Type string, which may not be null.

### init

    void init(NamedList args)

  `init` will be called just once, immediately after creation.

  The args are user-level initialization parameters that may be specified when declaring a response writer in solrconfig.xml

  Specified by:
    `init` in interface `NamedListInitializedPlugin`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD