Example usage for org.apache.solr.servlet ResponseUtils getErrorInfo

List of usage examples for org.apache.solr.servlet ResponseUtils getErrorInfo

Introduction

In this page you can find the example usage for org.apache.solr.servlet ResponseUtils getErrorInfo.

Prototype

public static int getErrorInfo(Throwable ex, NamedList info, Logger log) 

Source Link

Document

Adds the given Throwable's message to the given NamedList.

Usage

From source file:org.vootoo.server.RequestProcesser.java

License:Apache License

protected void writeResponse(SolrQueryResponse solrRsp, QueryResponseWriter responseWriter,
        SolrQueryRequest solrReq) throws IOException {
    Object invalidStates = solrReq.getContext().get(CloudSolrClient.STATE_VERSION);
    //This is the last item added to the applyResult and the client would expect it that way.
    //If that assumption is changed , it would fail. This is done to avoid an O(n) scan on
    // the applyResult for each request
    if (invalidStates != null)
        solrRsp.add(CloudSolrClient.STATE_VERSION, invalidStates);
    // Now write it out
    final String ct = responseWriter.getContentType(solrReq, solrRsp);
    // don't call setContentType on null
    if (null != ct) {
        responseSetter.setContentType(ct);
    }/*from  w  w w  .j  a v  a2 s  .c o m*/

    if (solrRsp.getException() != null) {
        NamedList info = new SimpleOrderedMap();
        int code = ResponseUtils.getErrorInfo(solrRsp.getException(), info, logger);
        //solrRsp.add("error", info);
        // use protocol response exception instead of set 'error' response return to client,
        responseSetter.setSolrResponseException(code, info);
    }

    QueryResponseWriterUtil.writeQueryResponse(responseSetter.getResponseOutputStream(), responseWriter,
            solrReq, solrRsp, ct);

    //fire QueryResponse write Complete
    responseSetter.writeQueryResponseComplete(solrRsp);
}