org.apache.solr.response
Class BinaryResponseWriter

java.lang.Object
  extended by org.apache.solr.response.BinaryResponseWriter
All Implemented Interfaces:
BinaryQueryResponseWriter, QueryResponseWriter, NamedListInitializedPlugin

public class BinaryResponseWriter
extends Object
implements BinaryQueryResponseWriter


Nested Class Summary
static class BinaryResponseWriter.Resolver
           
 
Field Summary
static Set<Class> KNOWN_TYPES
           
 
Fields inherited from interface org.apache.solr.response.QueryResponseWriter
CONTENT_TYPE_TEXT_ASCII, CONTENT_TYPE_TEXT_UTF8, CONTENT_TYPE_XML_UTF8
 
Constructor Summary
BinaryResponseWriter()
           
 
Method Summary
 String getContentType(SolrQueryRequest request, SolrQueryResponse response)
          Return the applicable Content Type for a request, this method must be thread safe.
static NamedList<Object> getParsedResponse(SolrQueryRequest req, SolrQueryResponse rsp)
          TODO -- there may be a way to do this without marshal at all...
 void init(NamedList args)
          init will be called just once, immediately after creation.
 void write(OutputStream out, SolrQueryRequest req, SolrQueryResponse response)
          Use it to write the reponse in a binary format
 void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response)
          Write a SolrQueryResponse, this method must be thread save.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KNOWN_TYPES

public static final Set<Class> KNOWN_TYPES
Constructor Detail

BinaryResponseWriter

public BinaryResponseWriter()
Method Detail

write

public void write(OutputStream out,
                  SolrQueryRequest req,
                  SolrQueryResponse response)
           throws IOException
Description copied from interface: BinaryQueryResponseWriter
Use it to write the reponse in a binary format

Specified by:
write in interface BinaryQueryResponseWriter
Throws:
IOException

write

public void write(Writer writer,
                  SolrQueryRequest request,
                  SolrQueryResponse response)
           throws IOException
Description copied from interface: QueryResponseWriter
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.

Specified by:
write in interface QueryResponseWriter
Throws:
IOException

getContentType

public String getContentType(SolrQueryRequest request,
                             SolrQueryResponse response)
Description copied from interface: QueryResponseWriter
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.

Specified by:
getContentType in interface QueryResponseWriter
Returns:
a Content-Type string, which may not be null.

init

public void init(NamedList args)
Description copied from interface: QueryResponseWriter
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 QueryResponseWriter
Specified by:
init in interface NamedListInitializedPlugin

getParsedResponse

public static NamedList<Object> getParsedResponse(SolrQueryRequest req,
                                                  SolrQueryResponse rsp)
TODO -- there may be a way to do this without marshal at all...

Returns:
a response object equivalent to what you get from the XML/JSON/javabin parser. Documents become SolrDocuments, DocList becomes SolrDocumentList etc.
Since:
solr 1.4


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.