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 } }
/** It is the users responsibility to close the request object when done with it. * This method does not set/clear SolrRequestInfo */ public SolrQueryResponse queryAndResponse(String handler, SolrQueryRequest req) throws Exception { try (SolrCore core = getCoreInc()) { SolrQueryResponse rsp = new SolrQueryResponse(); core.execute(core.getRequestHandler(handler), req, rsp); if (rsp.getException() != null) { throw rsp.getException(); } return rsp; } }
} else if (response.getException() != null) { String error = (String) ((NamedList<?>) response.getValues().get("error")).get("msg"); if (error == null) { error = response.getException().toString();
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp)); core.execute(core.getRequestHandler(handler),req,rsp); if (rsp.getException() != null) { throw rsp.getException();
NamedList<Object> shardInfo = new SimpleOrderedMap<Object>(); SimpleOrderedMap<Object> nl = new SimpleOrderedMap<Object>(); if (rb.rsp.getException() != null) { Throwable cause = rb.rsp.getException(); if (cause instanceof SolrServerException) { cause = ((SolrServerException)cause).getRootCause();
if (response.getException() != null) { throw new LuxException ("An error occurred while retrieving " + uri, response.getException());
core.execute(handler, solrReq, solrResp); if (solrResp.getException() != null) { response.setStatus(Status.SERVER_ERROR_INTERNAL, solrResp.getException()); } else { response.setEntity(new SolrRepresentation(