Search in sources :

Example 1 with BinaryQueryResponseWriter

use of org.apache.solr.request.BinaryQueryResponseWriter in project Solbase by Photobucket.

the class SolbaseDispatchFilter method writeResponse.

private void writeResponse(SolrQueryResponse solrRsp, ServletResponse response, QueryResponseWriter responseWriter, SolrQueryRequest solrReq, Method reqMethod) throws IOException {
    if (solrRsp.getException() != null) {
        sendError((HttpServletResponse) response, solrRsp.getException());
    } else {
        // Now write it out
        response.setContentType(responseWriter.getContentType(solrReq, solrRsp));
        if (Method.HEAD != reqMethod) {
            if (responseWriter instanceof BinaryQueryResponseWriter) {
                BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter) responseWriter;
                binWriter.write(response.getOutputStream(), solrReq, solrRsp);
            } else {
                PrintWriter out = response.getWriter();
                responseWriter.write(out, solrReq, solrRsp);
            }
        }
    // else http HEAD request, nothing to write out, waited this long
    // just to get ContentType
    }
}
Also used : BinaryQueryResponseWriter(org.apache.solr.request.BinaryQueryResponseWriter) PrintWriter(java.io.PrintWriter)

Aggregations

PrintWriter (java.io.PrintWriter)1 BinaryQueryResponseWriter (org.apache.solr.request.BinaryQueryResponseWriter)1