cancel
Showing results for 
Search instead for 
Did you mean: 

with LTS2015, how to force Http Response to set Content-Disposition to "inline" for blob documents ?

Henri_Jacob
Champ on-the-rise
Champ on-the-rise

Within a Nuxeo 5.8 webengine site, I used to force Http Response to set Content-Disposition to "inline" for blob documents. I do it this way :

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
...
Blob requestedBlob = (Blob) propertyFile.getValue();
ContentDisposition contentDisposition = ContentDisposition.type("inline").fileName(requestedFilename).creationDate(new Date()).build();;
requestedObject = Response.ok().header("Content-Disposition",contentDisposition).type(requestedBlob.getMimeType()).entity(requestedBlob).build();
return requestedObject;

This code doesn't work with LTS2015 plaform... Content-Disposition is always set to "attachment; filename=..." I saw that the artifact** javax.ws.rs:jsr311-api** used with Nuxeo 5.8 has been replaced by com.sun.jersey:jersey-server in LTS2015.

Here is my pom.xml:

	<parent>
		<groupId>org.nuxeo</groupId>
		<artifactId>nuxeo-addons-parent</artifactId>
		<version>7.10</version>
	</parent>
....
	<dependencies>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.core</groupId>
			<artifactId>nuxeo-core-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.platform</groupId>
			<artifactId>nuxeo-platform-relations-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.webengine</groupId>
			<artifactId>nuxeo-webengine-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.webengine</groupId>
			<artifactId>nuxeo-webengine-base</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.platform</groupId>
			<artifactId>nuxeo-platform-preview</artifactId>
		</dependency>
		<dependency>
			<groupId>org.nuxeo.ecm.core</groupId>
			<artifactId>nuxeo-core-mimetype</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>
	</dependencies>

Did I miss something?

Regards, Henri

0 REPLIES 0