Package org.apache.solr.response
Class JacksonJsonWriter
java.lang.Object
org.apache.solr.response.JacksonJsonWriter
- All Implemented Interfaces:
QueryResponseWriter,TextQueryResponseWriter,NamedListInitializedPlugin
A JSON ResponseWriter that uses jackson.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.solr.response.TextQueryResponseWriter
TextQueryResponseWriter.NonFlushingStream -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fasterxml.jackson.core.JsonFactoryprotected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenterprotected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinterprotected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinter.IndenterFields inherited from interface org.apache.solr.response.QueryResponseWriter
CONTENT_TYPE_TEXT_UTF8, CONTENT_TYPE_XML_UTF8 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetContentType(SolrQueryRequest request, SolrQueryResponse response) Return the applicable Content Type for a request, this method must be thread safe.org.apache.solr.common.PushWritergetWriter(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) voidwrite(OutputStream out, SolrQueryRequest request, SolrQueryResponse response, String contentType) Writes the response to theOutputStream.voidwrite(Writer writer, SolrQueryRequest request, SolrQueryResponse response) Write a SolrQueryResponse in a textual manner.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.util.plugin.NamedListInitializedPlugin
initMethods inherited from interface org.apache.solr.response.QueryResponseWriter
writeMethods inherited from interface org.apache.solr.response.TextQueryResponseWriter
writeToString
-
Field Details
-
SMALL_ARRAY_IDENTIFIER
protected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter SMALL_ARRAY_IDENTIFIER -
LARGE_ARRAY_IDENTIFIER
protected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinter.Indenter LARGE_ARRAY_IDENTIFIER -
jsonfactory
protected final com.fasterxml.jackson.core.JsonFactory jsonfactory -
pretty
protected static final com.fasterxml.jackson.core.util.DefaultPrettyPrinter pretty
-
-
Constructor Details
-
JacksonJsonWriter
public JacksonJsonWriter()
-
-
Method Details
-
write
public void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response, String contentType) throws IOException Description copied from interface:QueryResponseWriterWrites the response to theOutputStream.contentTypeis fromQueryResponseWriter.getContentType(SolrQueryRequest, SolrQueryResponse), and it's often ignored.- Specified by:
writein interfaceQueryResponseWriter- Specified by:
writein interfaceTextQueryResponseWriter- Throws:
IOException
-
write
public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse response) throws IOException Description copied from interface:TextQueryResponseWriterWrite a SolrQueryResponse in a textual manner.Information about the request (in particular: formatting options) may be obtained from
reqbut the dominant source of information should bersp.There are no mandatory actions that write must perform. An empty write implementation would fulfill all interface obligations.
- Specified by:
writein interfaceTextQueryResponseWriter- Throws:
IOException
-
getWriter
public org.apache.solr.common.PushWriter getWriter(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) throws IOException - Throws:
IOException
-
getContentType
Description copied from interface:QueryResponseWriterReturn 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:
getContentTypein interfaceQueryResponseWriter- Returns:
- a Content-Type string, which may not be null.
-