* @throws IOException if an error occurs.
*/
private void deliverResult(QueryHandler handler, Result result, HttpServletResponse res) throws IOException {
characterize(handler, result, res); // First, describe it using HTTP headers
if (result instanceof LargeResult) { // Is it a large result?
LargeResult lr = (LargeResult) result; // Yes, this is gonna take some special work
LargeProductQueryHandler lpqh = (LargeProductQueryHandler) handler; // First treat 'em as large
ProductRetriever retriever = new ProductRetriever(lpqh); // Large ones need a retriever
lr.setRetriever(retriever); // Set the retriever
}
BufferedInputStream in = null; // Start with no input stream
try { // Then try ...
in = new BufferedInputStream(result.getInputStream()); // To open the input stream
byte[] buf = new byte[512]; // And a byte buffer for data