Search in sources :

Example 1 with QueryResponseWriter

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

the class SolbaseDispatchFilter method handleAdminRequest.

@SuppressWarnings({ "unused", "unchecked" })
private void handleAdminRequest(HttpServletRequest req, ServletResponse response, SolrRequestHandler handler, SolrQueryRequest solrReq) throws IOException {
    SolrQueryResponse solrResp = new SolrQueryResponse();
    final NamedList<Object> responseHeader = new SimpleOrderedMap<Object>();
    solrResp.add("responseHeader", responseHeader);
    NamedList<Object> toLog = solrResp.getToLog();
    toLog.add("webapp", req.getContextPath());
    toLog.add("path", solrReq.getContext().get("path"));
    toLog.add("params", "{" + solrReq.getParamString() + "}");
    handler.handleRequest(solrReq, solrResp);
    SolrCore.setResponseHeaderValues(handler, solrReq, solrResp);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < toLog.size(); i++) {
        String name = toLog.getName(i);
        Object val = toLog.getVal(i);
        sb.append(name).append("=").append(val).append(" ");
    }
    QueryResponseWriter respWriter = SolrCore.DEFAULT_RESPONSE_WRITERS.get(solrReq.getParams().get(CommonParams.WT));
    if (respWriter == null)
        respWriter = SolrCore.DEFAULT_RESPONSE_WRITERS.get("standard");
    writeResponse(solrResp, response, respWriter, solrReq, Method.getMethod(req.getMethod()));
}
Also used : SolrQueryResponse(org.apache.solr.request.SolrQueryResponse) QueryResponseWriter(org.apache.solr.request.QueryResponseWriter) BinaryQueryResponseWriter(org.apache.solr.request.BinaryQueryResponseWriter) SimpleOrderedMap(org.apache.solr.common.util.SimpleOrderedMap)

Aggregations

SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)1 BinaryQueryResponseWriter (org.apache.solr.request.BinaryQueryResponseWriter)1 QueryResponseWriter (org.apache.solr.request.QueryResponseWriter)1 SolrQueryResponse (org.apache.solr.request.SolrQueryResponse)1