git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@173799 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ae35aa5f14
commit
6b7ee36ed3
|
@ -1,13 +1,9 @@
|
|||
package org.gcube.datatransfer.resolver.services;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -16,7 +12,6 @@ import javax.annotation.Nullable;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
@ -34,22 +29,14 @@ import org.gcube.datatransfer.resolver.SingleFileStreamingOutput;
|
|||
import org.gcube.datatransfer.resolver.Util;
|
||||
import org.gcube.datatransfer.resolver.gis.GeonetworkAccessParameter;
|
||||
import org.gcube.datatransfer.resolver.gis.GeonetworkInstance;
|
||||
import org.gcube.datatransfer.resolver.gis.GeonetworkServiceInterface;
|
||||
import org.gcube.datatransfer.resolver.gis.exception.GeonetworkInstanceException;
|
||||
import org.gcube.datatransfer.resolver.gis.geonetwork.FilterGetRecords;
|
||||
import org.gcube.datatransfer.resolver.gis.geonetwork.GNAuthentication;
|
||||
import org.gcube.datatransfer.resolver.gis.geonetwork.HTTPCallsUtils;
|
||||
import org.gcube.datatransfer.resolver.gis.geonetwork.HTTPCallsUtils.HttpResponse;
|
||||
import org.gcube.datatransfer.resolver.gis.geonetwork.ReusableInputStream;
|
||||
import org.gcube.datatransfer.resolver.gis.util.GetResponseRecordFilter;
|
||||
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
|
||||
import org.gcube.datatransfer.resolver.services.exceptions.InternalServerException;
|
||||
import org.gcube.spatial.data.geonetwork.configuration.Configuration;
|
||||
import org.gcube.spatial.data.geonetwork.model.Account;
|
||||
import org.gcube.spatial.data.geonetwork.model.Account.Type;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* The Class GeonetworkResolver.
|
||||
|
@ -106,19 +93,18 @@ public class GeonetworkResolver {
|
|||
*/
|
||||
|
||||
@GET
|
||||
@Path("/{"+PATH_PARAM_SCOPE+":([^/?$]+)?}/{"+PATH_PARAM_MODE+"}/{"+PATH_PARAM_VISIBILITY+"}/{"+PATH_PARAM_OWNER+":([^/?$]+)?}/{"+PATH_PARAM_REQUEST_DELIMITER+"}{remainPath:(/[^/?$]+)?}")
|
||||
@Path("{"+PATH_PARAM_SCOPE+"}/{"+PATH_PARAM_MODE+"}/{"+PATH_PARAM_VISIBILITY+"}/{"+PATH_PARAM_OWNER+"}/$${remainPath:(/[^?$]+)?}")
|
||||
public Response submitGet(@Context HttpServletRequest req,
|
||||
@PathParam(PATH_PARAM_SCOPE) @Nullable String scope,
|
||||
@PathParam(PATH_PARAM_MODE) @Nullable String mode,
|
||||
@PathParam(PATH_PARAM_VISIBILITY) @Nullable String visibility,
|
||||
@PathParam(PATH_PARAM_OWNER) @Nullable String owner,
|
||||
@PathParam(PATH_PARAM_REQUEST_DELIMITER) @Nullable String requestDelimiter,
|
||||
@PathParam("remainPath") @Nullable String remainPath,
|
||||
@QueryParam(QUERY_PARAM_RESET_CACHE_PARAM) @Nullable String resetCache,
|
||||
@QueryParam(QUERY_PARAM_RESET_CACHED_SCOPE_PARAM) @Nullable String resetScope) {
|
||||
|
||||
logger.info(this.getClass().getSimpleName()+" GET starts...");
|
||||
logger.info("Params are [mode: "+mode+", scope: "+scope+", visibility: "+visibility+", owner: "+owner+", requestDelimiter: "+requestDelimiter+", remainPath: "+remainPath+"]");
|
||||
logger.info("Params are [mode: "+mode+", scope: "+scope+", visibility: "+visibility+", owner: "+owner+", remainPath: "+remainPath+"]");
|
||||
|
||||
if(scope==null || scope.isEmpty()){
|
||||
logger.error("Path Parameter 'scope' not found");
|
||||
|
@ -153,10 +139,10 @@ public class GeonetworkResolver {
|
|||
ExceptionManager.throwWrongParameterException(req, "The 'visibility' parameter must be value of "+toPrint, GeonetworkResolver.class, help);
|
||||
}
|
||||
|
||||
if(requestDelimiter==null || requestDelimiter.compareTo(VALUE_OF_REQUEST_DELIMITIER)!=0){
|
||||
/*if(requestDelimiter==null || requestDelimiter.compareTo(VALUE_OF_REQUEST_DELIMITIER)!=0){
|
||||
logger.error("Path Parameter to REQUEST_DELIMITIER '"+VALUE_OF_REQUEST_DELIMITIER+"' not found");
|
||||
ExceptionManager.throwBadRequestException(req, "Path Parameter '"+VALUE_OF_REQUEST_DELIMITIER+"' not found as REQUEST DELIMITER", GeonetworkResolver.class, help);
|
||||
}
|
||||
}*/
|
||||
|
||||
if(resetCache!=null && Boolean.parseBoolean(resetCache)){
|
||||
purgeCacheGeonetworkInstances();
|
||||
|
@ -276,7 +262,7 @@ public class GeonetworkResolver {
|
|||
/**
|
||||
* Submit post.
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
/* @SuppressWarnings("resource")
|
||||
@POST
|
||||
@Path("/{"+PATH_PARAM_SCOPE+":(/[^/?$]+)?}}/{"+PATH_PARAM_MODE+"}/{"+PATH_PARAM_VISIBILITY+"}/{"+PATH_PARAM_OWNER+"}/{"+PATH_PARAM_REQUEST_DELIMITER+"}")
|
||||
public Response submitPost(@Context HttpServletRequest req,
|
||||
|
@ -517,7 +503,7 @@ public class GeonetworkResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Purge remain from query string.
|
||||
|
|
Loading…
Reference in New Issue