code: private Response downloadArtifact(Node node) throws Exception
     {
        NodeRepresentation nodeRepresentation = nodeRepresentationService.getNodeRepresentation(node, null);
        if (node.canAddMixin("exo:mavencounter"))
        {
           node.addMixin("exo:mavencounter");
           node.getSession().save();
        }
        node.setProperty("exo:downloadcounter", node.getProperty("exo:downloadcounter").getLong() + 1l);
        node.getSession().save();
        long lastModified = nodeRepresentation.getLastModified();
        String contentType = nodeRepresentation.getMediaType();
        long contentLength = nodeRepresentation.getContentLenght();
        InputStream entity = nodeRepresentation.getInputStream();
        Response response =
           Response.ok(entity, contentType).header(HttpHeaders.CONTENT_LENGTH, Long.toString(contentLength))
              .lastModified(new Date(lastModified)).build();
        return response;
     }
docs: Get content of JCR node.
  
  @param node
  the node.
  @return @see {@link Response}.
  @throws Exception
  if any errors occurs.