removed ETag
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@176400 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0903a36e78
commit
a041a9f862
8
pom.xml
8
pom.xml
|
@ -84,6 +84,14 @@
|
|||
<version>[0.0.1-SNAPSHOT,1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- TODO REMOVE THIS IMPORT -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>gxHTTP</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
|
|
|
@ -12,7 +12,7 @@ package org.gcube.datatransfer.resolver;
|
|||
*/
|
||||
public class ConstantsResolver {
|
||||
|
||||
public static final String CONTENT_DISPOSITION = "content-disposition";
|
||||
public static final String CONTENT_DISPOSITION = "Content-Disposition";
|
||||
public static final String DEFAULT_CONTENTTYPE_UNKNOWN_UNKNOWN = "unknown/unknown";
|
||||
public static final String DEFAULT_FILENAME_FROM_STORAGE_MANAGER = "fromStorageManager";
|
||||
public static final String CONTENT_LENGTH = "Content-Length";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.datatransfer.resolver.services;
|
||||
|
||||
import static org.gcube.common.storagehub.model.Constants.versionPrefix;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -142,13 +140,13 @@ public class StorageHubResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Download version.
|
||||
* Download version. NEVER USED
|
||||
*
|
||||
* @param req the req
|
||||
* @param version the version
|
||||
* @return the response
|
||||
*/
|
||||
@GET
|
||||
/*@GET
|
||||
@Path("{version}")
|
||||
public Response downloadVersion(@Context HttpServletRequest req, @PathParam("version") String version) {
|
||||
logger.info(this.getClass().getSimpleName() +" GET downloadVersion called");
|
||||
|
@ -195,5 +193,5 @@ public class StorageHubResolver {
|
|||
logger.error("Exception:", e);
|
||||
throw (WebApplicationException) e;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ public class StorageIDResolver {
|
|||
|
||||
ResponseBuilder response = Response
|
||||
.ok(so)
|
||||
.header(ConstantsResolver.CONTENT_DISPOSITION,"attachment; filename = \""+fileName+"\"")
|
||||
.header(ConstantsResolver.CONTENT_DISPOSITION,"attachment; filename=\""+fileName+"\"")
|
||||
.header(ConstantsResolver.CONTENT_LENGTH, size);
|
||||
|
||||
if (contentType!= null)
|
||||
|
|
|
@ -9,6 +9,7 @@ import javax.ws.rs.core.Response.ResponseBuilder;
|
|||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.datatransfer.resolver.ConstantsResolver;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,6 @@ public class StorageHubMetadataResponseBuilder {
|
|||
|
||||
/**
|
||||
* Fill metadata.
|
||||
* By default it adds the ETag (see at https://tools.ietf.org/html/rfc7232#section-2.3) to last version of entity
|
||||
* @param streamDescriptor the stream descriptor
|
||||
* @param entityId the entity id
|
||||
* @return the response builder
|
||||
|
@ -46,17 +46,18 @@ public class StorageHubMetadataResponseBuilder {
|
|||
public ResponseBuilder fillMetadata(StreamDescriptor streamDescriptor, String entityId){
|
||||
|
||||
//Adding "Content-Disposition"
|
||||
responseBuilder.header("Content-Disposition","attachment; filename = \""+streamDescriptor.getFileName()+"\"");
|
||||
responseBuilder.header(ConstantsResolver.CONTENT_DISPOSITION,"attachment; filename=\""+streamDescriptor.getFileName()+"\"");
|
||||
|
||||
//Adding "Content-Location"
|
||||
String contentLocation = String.format("%s/%s/%s", Util.getServerURL(request), "shub", entityId);
|
||||
responseBuilder.header("Content-Location", contentLocation);
|
||||
|
||||
//Managing "Content-Type"
|
||||
if (streamDescriptor.getContentType() != null && !streamDescriptor.getContentType().isEmpty())
|
||||
if (streamDescriptor.getContentType()!= null && !streamDescriptor.getContentType().isEmpty())
|
||||
responseBuilder.header("Content-Type", streamDescriptor.getContentType()+"; charset=utf-8");
|
||||
|
||||
//Managing "ETag"
|
||||
//Here is not feasible because the entityId is cripted
|
||||
// List<Version> versions = client.getFileVersions(entityId);
|
||||
// if(versions!=null && !versions.isEmpty()){
|
||||
// responseBuilder.header("ETag", versions.get(versions.size()));
|
||||
|
|
Loading…
Reference in New Issue