git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@173724 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
29da3a8dec
commit
da0e2e6e5e
38
pom.xml
38
pom.xml
|
@ -1,4 +1,5 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
@ -55,13 +56,13 @@
|
|||
<!-- <version>6.0.16</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
|
@ -73,7 +74,7 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
|
@ -84,14 +85,19 @@
|
|||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>discovery-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-client-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- jersey -->
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
|
@ -108,14 +114,14 @@
|
|||
<artifactId>jersey-gf-cdi</artifactId>
|
||||
<version>2.13</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>javax.transaction-api</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- weld -->
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
|
@ -133,14 +139,14 @@
|
|||
<artifactId>jandex</artifactId>
|
||||
<version>1.2.2.Final</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
|
@ -148,8 +154,8 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- GIS RESOLVER DEPENDENCIES -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.spatial.data</groupId>
|
||||
|
@ -192,14 +198,14 @@
|
|||
<artifactId>commons-io</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.datatransfer.resolver.services;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.gcube.common.storagehub.client.StreamDescriptor;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
|
||||
@Path("shub/{id}")
|
||||
public class StorageHub {
|
||||
|
||||
@RequestScoped
|
||||
@PathParam("id")
|
||||
String id;
|
||||
|
||||
@GET
|
||||
@Path("")
|
||||
public Response download() {
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
StreamDescriptor descriptor = shc.open(id).asFile().download();
|
||||
|
||||
return Response
|
||||
.ok(descriptor.getStream())
|
||||
.header("content-disposition","attachment; filename = \""+descriptor.getFileName()+"\"").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{version}")
|
||||
public Response downloadVersion(@PathParam("version") String version) {
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
StreamDescriptor descriptor = shc.open(id).asFile().downloadSpecificVersion(version);
|
||||
return Response
|
||||
.ok(descriptor.getStream())
|
||||
.header("content-disposition","attachment; filename = \""+descriptor.getFileName()+"\"").build();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue