task_24792 #7
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +14,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="uri-resolver-2.8.1">
|
<wb-module deploy-name="uri-resolver-2.8.1">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +29,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +44,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +59,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,10 +74,11 @@
|
||||||
|
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +92,8 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="uri-resolver"/>
|
<property name="context-root" value="uri-resolver"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +107,8 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
<property name="java-output-path" value="/uri-resolver/target/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +122,8 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -245,7 +259,7 @@ public class GeoportalResolver {
|
||||||
@PathParam(PATH_VRE_NAME) String vreName, @PathParam(PATH_USECASE_ID) String ucdID,
|
@PathParam(PATH_VRE_NAME) String vreName, @PathParam(PATH_USECASE_ID) String ucdID,
|
||||||
@PathParam(PATH_PROJECT_ID) String projectID, @QueryParam(QP_RESOLVE_AS) String resolveAs)
|
@PathParam(PATH_PROJECT_ID) String projectID, @QueryParam(QP_RESOLVE_AS) String resolveAs)
|
||||||
throws WebApplicationException {
|
throws WebApplicationException {
|
||||||
|
|
||||||
LOG.info(this.getClass().getSimpleName() + " genericResolveLink starts...");
|
LOG.info(this.getClass().getSimpleName() + " genericResolveLink starts...");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -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