List of usage examples for org.apache.solr.client.solrj.impl BinaryResponseParser processResponse
@Override
public NamedList<Object> processResponse(InputStream body, String encoding)
From source file:com.doculibre.constellio.wicket.servlet.SolrServletEmulator.java
License:Open Source License
/** * Parse the solr response to named list (need to create solrj query * respond)./* w w w . ja v a 2 s . c o m*/ * * @param req * The request. * @param rsp * The response. * @return The named list. */ public NamedList<Object> getParsedResponse(SolrQueryRequest req, SolrQueryResponse rsp) { try { BinaryResponseWriter writer = new BinaryResponseWriter(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); writer.write(bos, req, rsp); BinaryResponseParser parser = new BinaryResponseParser(); return parser.processResponse(new ByteArrayInputStream(bos.toByteArray()), "UTF-8"); } catch (Exception ex) { throw new RuntimeException(ex); } }