@PathParam("user_id") String userId, @PathParam("owner_id") String ownerId,
@PathParam("name") String name) {
final Session session = credentials.buildSession(userDAO, userId);
final User owner = findUser(ownerId);
final Document doc = findDocument(owner, name);
checkLinkage(doc, session.getUser());
try {
final byte[] body = doc.decryptBody(session.getKeySet());
return Response.ok()
.entity(body)
.type(doc.getContentType())
.cacheControl(CACHE_SETTINGS)
.lastModified(doc.getModifiedAt().toDate())
.build();
} catch (CryptographicException e) {
throw new RuntimeException(e);
}
}