@Test public void testGetFileByIdentifier() { Response r = target.path("file").request().get(); }
@GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFileByIdentifier(@PathParam("identifier") String identifier) { ResponseBuilder response; File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads"); try { HBaseFile hbf = HBaseFile.Factory.buildHBaseFile(identifier); InputStream hfis = new HBaseFileInputStream(hbf); response = Response.ok().entity(hfis) .header("Content-Disposition", "attachment; filename=\"" + hbf.getDesc() + "\""); } catch (FileNotFoundException ex) { response = Response.noContent(); log.warn("File not exist: " + identifier); } catch (Exception e) { response = Response.serverError(); log.error("Unkonwn error.", e); } return response.build(); }
HBaseFileRESTful { @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFileByIdentifier(@PathParam("identifier") String identifier) { ResponseBuilder response; File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads"); try { HBaseFile hbf = HBaseFile.Factory.buildHBaseFile(identifier); InputStream hfis = new HBaseFileInputStream(hbf); response = Response.ok().entity(hfis) .header("Content-Disposition", "attachment; filename=\"" + hbf.getDesc() + "\""); } catch (FileNotFoundException ex) { response = Response.noContent(); log.warn("File not exist: " + identifier); } catch (Exception e) { response = Response.serverError(); log.error("Unkonwn error.", e); } return response.build(); } }
HBaseFileRESTful { @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFileByIdentifier(@PathParam("identifier") String identifier) { ResponseBuilder response; File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads"); try { HBaseFile hbf = HBaseFile.Factory.buildHBaseFile(identifier); InputStream hfis = new HBaseFileInputStream(hbf); response = Response.ok().entity(hfis) .header("Content-Disposition", "attachment; filename=\"" + hbf.getDesc() + "\""); } catch (FileNotFoundException ex) { response = Response.noContent(); log.warn("File not exist: " + identifier); } catch (Exception e) { response = Response.serverError(); log.error("Unkonwn error.", e); } return response.build(); }  }
HBaseFileRESTful { @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFileByIdentifier(@PathParam("identifier") String identifier) { ResponseBuilder response; File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads"); try { HBaseFile hbf = HBaseFile.Factory.buildHBaseFile(identifier); InputStream hfis = new HBaseFileInputStream(hbf); response = Response.ok().entity(hfis) .header("Content-Disposition", "attachment; filename=\"" + hbf.getDesc() + "\""); } catch (FileNotFoundException ex) { response = Response.noContent(); log.warn("File not exist: " + identifier); } catch (Exception e) { response = Response.serverError(); log.error("Unkonwn error.", e); } return response.build(); }  @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.TEXT_PLAIN) Response uploadFile(
			@FormDataParam("file") InputStream uploadedInputStream,
			@FormDataParam("file") FormDataContentDisposition fileDetail); @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) Response getFileByIdentifier(@PathParam("identifier") String identifier); @DELETE @Path("{identifier}") @Produces(MediaType.TEXT_PLAIN) Response deleteFileByIdentifier(@PathParam("identifier") String identifier); }
HBaseFileRESTful { @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFileByIdentifier(@PathParam("identifier") String identifier) { ResponseBuilder response; File file = new File(FileUtils.getTempDirectory() + File.separator + "downloads"); try { HBaseFile hbf = HBaseFile.Factory.buildHBaseFile(identifier); InputStream hfis = new HBaseFileInputStream(hbf); response = Response.ok().entity(hfis) .header("Content-Disposition", "attachment; filename=\"" + hbf.getDesc() + "\""); } catch (FileNotFoundException ex) { response = Response.noContent(); log.warn("File not exist: " + identifier); } catch (Exception e) { response = Response.serverError(); log.error("Unkonwn error.", e); } return response.build(); }  @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.TEXT_PLAIN) Response uploadFile(
			@FormDataParam("file") InputStream uploadedInputStream,
			@FormDataParam("file") FormDataContentDisposition fileDetail); @GET @Path("{identifier}") @Produces(MediaType.APPLICATION_OCTET_STREAM) Response getFileByIdentifier(@PathParam("identifier") String identifier); @DELETE @Path("{identifier}") @Produces(MediaType.TEXT_PLAIN) Response deleteFileByIdentifier(@PathParam("identifier") String identifier);  }