Search in sources :

Example 1 with Download

use of org.platformlayer.ops.OneTimeDownloads.Download in project platformlayer by platformlayer.

the class BlobsResource method downloadBlob.

@GET
@Path("blob/{blobId}")
public Response downloadBlob(@PathParam("blobId") String blobId) {
    Download download = oneTimeDownloads.get(blobId);
    if (download == null) {
        throw new WebApplicationException(Status.NOT_FOUND);
    }
    String responseData = download.getContent();
    String contentType = download.getContentType();
    ResponseBuilder rBuild = Response.ok(responseData, contentType);
    return rBuild.build();
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) ResponseBuilder(javax.ws.rs.core.Response.ResponseBuilder) Download(org.platformlayer.ops.OneTimeDownloads.Download) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)1 Download (org.platformlayer.ops.OneTimeDownloads.Download)1