task_24792 #7
|
@ -12,6 +12,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="uri-resolver-2.8.1">
|
||||
|
||||
|
||||
|
@ -26,6 +27,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<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"/>
|
||||
|
||||
|
||||
|
@ -54,6 +57,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<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"/>
|
||||
<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>
|
||||
</dependent-module>
|
||||
|
||||
|
@ -85,6 +90,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="uri-resolver"/>
|
||||
|
||||
|
||||
|
@ -99,6 +105,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
||||
|
||||
|
||||
|
@ -113,6 +120,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
@ -127,4 +135,5 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.datatransfer.resolver.services;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
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 gcubeScope the gcube scope
|
||||
* @param itemId the item id
|
||||
* @param itemType the item type
|
||||
* @param resolveAs the resolve as
|
||||
* @return the response
|
||||
* @throws WebApplicationException the web application exception
|
||||
*/
|
||||
@GET
|
||||
@Path("/")
|
||||
public Response createDataViewerLink(@Context HttpServletRequest req,
|
||||
public Response resolveDataViewerLink(@Context HttpServletRequest req,
|
||||
@QueryParam(GeoportalRequest.P_GCUBE_SCOPE) String gcubeScope,
|
||||
@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);
|
||||
LOG.info("The target app is: " + targetAppGeoportalCodes);
|
||||
GeoportalRequest geoportalRequest = new GeoportalRequest();
|
||||
geoportalRequest.setGcubeScope(gcubeScope);
|
||||
geoportalRequest.setItemID(itemId);
|
||||
geoportalRequest.setItemType(itemType);
|
||||
return genericCreateLink(req, geoportalRequest, targetAppGeoportalCodes);
|
||||
|
||||
if (gcubeScope == null || gcubeScope.isEmpty()) {
|
||||
|
||||
LOG.error("The query parameter '" + GeoportalRequest.P_GCUBE_SCOPE + "' not found or empty");
|
||||
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...");
|
||||
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, null);
|
||||
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...");
|
||||
TargetAppGeoportalCodes targetAppGeoportalCodes = checkTargetApplictionID(req, targetAppId);
|
||||
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 jsonRequest the json request
|
||||
* @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) {
|
||||
|
||||
LOG.info(this.getClass().getSimpleName() + " genericCreateLink starts...");
|
||||
|
@ -465,7 +479,7 @@ public class GeoportalResolver {
|
|||
}
|
||||
|
||||
LOG.info("Returning " + GeoportalResolver.class.getSimpleName() + " URL: " + linkURL);
|
||||
return Response.ok(linkURL).header("Location", linkURL).build();
|
||||
return linkURL;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue