Search in sources :

Example 1 with DocumentBlobHolder

use of org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder in project nuxeo-filesystem-connectors by nuxeo.

the class FileResource method get.

@GET
public Object get() {
    BlobHolder bh = doc.getAdapter(BlobHolder.class);
    Blob blob = bh == null ? null : bh.getBlob();
    if (blob == null) {
        return Response.ok("").build();
    }
    String mimeType = blob.getMimeType();
    if (mimeType.equals("???")) {
        mimeType = "application/octet-stream";
    }
    // provide full DocumentBlobHolder context if possible, to give more info when calling the DownloadService
    Object entity = bh instanceof DocumentBlobHolder ? bh : blob;
    return Response.ok(entity).type(mimeType).build();
}
Also used : Blob(org.nuxeo.ecm.core.api.Blob) BlobHolder(org.nuxeo.ecm.core.api.blobholder.BlobHolder) DocumentBlobHolder(org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder) DocumentBlobHolder(org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)1 Blob (org.nuxeo.ecm.core.api.Blob)1 BlobHolder (org.nuxeo.ecm.core.api.blobholder.BlobHolder)1 DocumentBlobHolder (org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder)1