task_24792 #7
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="uri-resolver-2.8.1">
|
<wb-module deploy-name="uri-resolver-2.8.1">
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +57,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,8 +72,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="uri-resolver-manager-1.6.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
|
<dependent-module archiveName="uri-resolver-manager-1.7.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
||||||
|
@ -85,6 +90,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="uri-resolver"/>
|
<property name="context-root" value="uri-resolver"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,6 +105,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,6 +120,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,4 +135,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.datatransfer.resolver.services;
|
package org.gcube.datatransfer.resolver.services;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -126,30 +128,40 @@ public class GeoportalResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the data viewer link.
|
* Resolve data viewer link.
|
||||||
*
|
*
|
||||||
* @param req the req
|
* @param req the req
|
||||||
* @param gcubeScope the gcube scope
|
* @param gcubeScope the gcube scope
|
||||||
* @param itemId the item id
|
* @param itemId the item id
|
||||||
* @param itemType the item type
|
* @param itemType the item type
|
||||||
|
* @param resolveAs the resolve as
|
||||||
* @return the response
|
* @return the response
|
||||||
* @throws WebApplicationException the web application exception
|
* @throws WebApplicationException the web application exception
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public Response createDataViewerLink(@Context HttpServletRequest req,
|
public Response resolveDataViewerLink(@Context HttpServletRequest req,
|
||||||
@QueryParam(GeoportalRequest.P_GCUBE_SCOPE) String gcubeScope,
|
@QueryParam(GeoportalRequest.P_GCUBE_SCOPE) String gcubeScope,
|
||||||
@QueryParam(GeoportalRequest.P_ITEM_ID) String itemId,
|
@QueryParam(GeoportalRequest.P_ITEM_ID) String itemId,
|
||||||
@QueryParam(GeoportalRequest.P_ITEM_TYPE) String itemType) throws WebApplicationException {
|
@QueryParam(GeoportalRequest.P_ITEM_TYPE) String itemType,
|
||||||
|
@QueryParam(QP_RESOLVE_AS) String resolveAs)
|
||||||
|
throws WebApplicationException {
|
||||||
|
|
||||||
LOG.info(this.getClass().getSimpleName() + " createDataViewerLink - GET starts...");
|
LOG.info(this.getClass().getSimpleName() + " resolveDataViewerLink - GET starts...");
|
||||||
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
|
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
|
||||||
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
||||||
GeoportalRequest geoportalRequest = new GeoportalRequest();
|
|
||||||
geoportalRequest.setGcubeScope(gcubeScope);
|
if (gcubeScope == null || gcubeScope.isEmpty()) {
|
||||||
geoportalRequest.setItemID(itemId);
|
|
||||||
geoportalRequest.setItemType(itemType);
|
LOG.error("The query parameter '" + GeoportalRequest.P_GCUBE_SCOPE + "' not found or empty");
|
||||||
return genericCreateLink(req, geoportalRequest, targetAppGeoportalCodes);
|
throw ExceptionManager.badRequestException(req,
|
||||||
|
"Mandatory query parameter '" + GeoportalRequest.P_GCUBE_SCOPE + "' not found or empty",
|
||||||
|
this.getClass(), helpURI);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String scope = gcubeScope.substring(gcubeScope.lastIndexOf("/") + 1, gcubeScope.length());
|
||||||
|
return genericResolveLink(req, targetAppGeoportalCodes, scope, itemType, itemId, resolveAs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +183,8 @@ public class GeoportalResolver {
|
||||||
LOG.info(this.getClass().getSimpleName() + " postGeoportalNoAppDef - POST starts...");
|
LOG.info(this.getClass().getSimpleName() + " postGeoportalNoAppDef - POST starts...");
|
||||||
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
|
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
|
||||||
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
||||||
return genericCreateLink(req, jsonRequest, targetAppGeoportalCodes);
|
String linkURL = genericCreateLink(req, jsonRequest, targetAppGeoportalCodes);
|
||||||
|
return Response.ok(linkURL).header("Location", linkURL).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,7 +206,8 @@ public class GeoportalResolver {
|
||||||
LOG.info(this.getClass().getSimpleName() + " postGeoportal - POST starts...");
|
LOG.info(this.getClass().getSimpleName() + " postGeoportal - POST starts...");
|
||||||
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, targetAppId);
|
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, targetAppId);
|
||||||
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
||||||
return genericCreateLink(req, jsonRequest, targetAppGeoportalCodes);
|
String linkURL = genericCreateLink(req, jsonRequest, targetAppGeoportalCodes);
|
||||||
|
return Response.ok(linkURL).header("Location", linkURL).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,9 +416,9 @@ public class GeoportalResolver {
|
||||||
* @param req the req
|
* @param req the req
|
||||||
* @param jsonRequest the json request
|
* @param jsonRequest the json request
|
||||||
* @param targetAppGeoportalCodes the target app geoportal codes
|
* @param targetAppGeoportalCodes the target app geoportal codes
|
||||||
* @return the response
|
* @return the URL
|
||||||
*/
|
*/
|
||||||
protected Response genericCreateLink(@Context HttpServletRequest req, GeoportalRequest jsonRequest,
|
protected String genericCreateLink(@Context HttpServletRequest req, GeoportalRequest jsonRequest,
|
||||||
TargetAppGeoportalCodes targetAppGeoportalCodes) {
|
TargetAppGeoportalCodes targetAppGeoportalCodes) {
|
||||||
|
|
||||||
LOG.info(this.getClass().getSimpleName() + " genericCreateLink starts...");
|
LOG.info(this.getClass().getSimpleName() + " genericCreateLink starts...");
|
||||||
|
@ -465,7 +479,7 @@ public class GeoportalResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("Returning " + GeoportalResolver.class.getSimpleName() + " URL: " + linkURL);
|
LOG.info("Returning " + GeoportalResolver.class.getSimpleName() + " URL: " + linkURL);
|
||||||
return Response.ok(linkURL).header("Location", linkURL).build();
|
return linkURL;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue