mirror of https://github.com/apache/lucene.git
SOLR-377: make sure FastWriter buffer is flushed after writing response
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@586617 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37345a65d3
commit
a899f9e24b
|
@ -43,7 +43,11 @@ public class JSONResponseWriter implements QueryResponseWriter {
|
|||
|
||||
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
|
||||
JSONWriter w = new JSONWriter(writer, req, rsp);
|
||||
w.writeResponse();
|
||||
try {
|
||||
w.writeResponse();
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
|
||||
|
@ -83,7 +87,6 @@ class JSONWriter extends TextResponseWriter {
|
|||
if(wrapperFunction!=null) {
|
||||
writer.write(')');
|
||||
}
|
||||
writer.flushBuffer();
|
||||
}
|
||||
|
||||
protected void writeKey(String fname, boolean needsEscaping) throws IOException {
|
||||
|
|
|
@ -31,7 +31,11 @@ public class PHPResponseWriter implements QueryResponseWriter {
|
|||
|
||||
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
|
||||
PHPWriter w = new PHPWriter(writer, req, rsp);
|
||||
w.writeResponse();
|
||||
try {
|
||||
w.writeResponse();
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
|
||||
|
|
|
@ -43,7 +43,11 @@ public class PHPSerializedResponseWriter implements QueryResponseWriter {
|
|||
|
||||
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
|
||||
PHPSerializedWriter w = new PHPSerializedWriter(writer, req, rsp);
|
||||
w.writeResponse();
|
||||
try {
|
||||
w.writeResponse();
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
|
||||
|
|
|
@ -31,7 +31,11 @@ public class PythonResponseWriter implements QueryResponseWriter {
|
|||
|
||||
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
|
||||
PythonWriter w = new PythonWriter(writer, req, rsp);
|
||||
w.writeResponse();
|
||||
try {
|
||||
w.writeResponse();
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
|
||||
|
|
|
@ -30,7 +30,11 @@ public class RubyResponseWriter implements QueryResponseWriter {
|
|||
|
||||
public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
|
||||
RubyWriter w = new RubyWriter(writer, req, rsp);
|
||||
w.writeResponse();
|
||||
try {
|
||||
w.writeResponse();
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
||||
public String getContentType(SolrQueryRequest request, SolrQueryResponse response) {
|
||||
|
|
|
@ -59,6 +59,11 @@ public abstract class TextResponseWriter {
|
|||
returnFields = rsp.getReturnFields();
|
||||
}
|
||||
|
||||
/** done with this ResponseWriter... make sure any buffers are flushed to writer */
|
||||
public void close() throws IOException {
|
||||
writer.flushBuffer();
|
||||
}
|
||||
|
||||
/** returns the Writer that the response is being written to */
|
||||
public Writer getWriter() { return writer; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue