Project

General

Profile

« Previous | Next » 

Revision 7757

use ContentTypeInputStream interface (and ByteArray implementation) to specify the desired content-type of the InputStream returned by MN.query().

View differences:

SolrQueryResponseTransformer.java
40 40
import org.apache.solr.response.QueryResponseWriter;
41 41
import org.apache.solr.response.SolrQueryResponse;
42 42

  
43
import edu.ucsb.nceas.metacat.common.query.stream.ContentTypeByteArrayInputStream;
44

  
43 45
/**
44 46
 * Transform the solr QueryReponse to the InputStream. Currently it works only for
45 47
 * The EmbeddedSolrServer.
......
74 76
        SolrQueryResponse sResponse = new SolrQueryResponse();
75 77
        sResponse.setAllValues(response.getResponse());
76 78
        writer.write(results, new LocalSolrQueryRequest(core, request), sResponse);
77
        return new ByteArrayInputStream(results.toString().getBytes("UTF-8"));
79
        ContentTypeByteArrayInputStream ctbais = new ContentTypeByteArrayInputStream(results.toString().getBytes("UTF-8"));
80
        ctbais.setContentType(SolrQueryResponseWriterFactory.getContentType(wt));
81
        return ctbais;
78 82
    }
79 83
}

Also available in: Unified diff