HttpRequestImpl req = new HttpRequestImpl(requestMetaData, inputStream);
if (req.getMethod().equalsIgnoreCase("HEAD")) {
ostr = new NoBodyOutputStream(ostr);
}
ServletOutputStreamImpl outputStream = new ServletOutputStreamImpl(ostr, 2048);
HttpResponse resp = null;
try {
resp = new HttpResponseImpl(req, outputStream);
handler.handleRequest(req, resp);
} finally {
// ensure that any buffered bytes get committed. No byte left behind!
resp.flushBuffer();
}
}