use of org.apache.jackrabbit.oak.remote.RemoteBinaryFilters in project jackrabbit-oak by apache.
the class GetBinaryHandler method handleFile.
/**
* RFC7233
* <p/>
* This handler sends a 200 OK http status, the Content-Length header and
* the entire file/binary content. This is used when the request Range
* header is missing or it contains a malformed value.
*/
private void handleFile(HttpServletResponse response, RemoteSession session, RemoteBinaryId binaryId) throws IOException {
InputStream in = session.readBinary(binaryId, new RemoteBinaryFilters());
long length = session.readBinaryLength(binaryId);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("application/octet-stream");
response.setContentLength((int) length);
OutputStream out = response.getOutputStream();
ByteStreams.copy(in, out);
out.close();
}
Aggregations