UPDATED SCOPE SEPARATOR TO CHAR "|" DUE TO "_" CHAR IS USED BY CERTAIN VRE NAME
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@131250 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2338561986
commit
bf8d6ab53f
|
@ -20,13 +20,18 @@ import org.slf4j.LoggerFactory;
|
|||
* This class parses a request from servletpath and queryString
|
||||
*
|
||||
* The request must be: SCOPE#PARMETERS
|
||||
* SCOPE must be: separated by _
|
||||
* SCOPE must be: separated by {@link GeonetworkRequestDecoder#SCOPE_SEPARATOR}
|
||||
* PARAMETERS can be:
|
||||
* {@link GeonetworkResolver#PARAMETER_FILTER_PUBLIC_IDS}
|
||||
* {@link GeonetworkResolver#PARAMETER_NO_AUTHENTICATION}
|
||||
*/
|
||||
public class GeonetworkRequestDecoder {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static final String SCOPE_SEPARATOR = "|";
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(GeonetworkRequestDecoder.class);
|
||||
|
||||
private String newURI;
|
||||
|
@ -93,7 +98,7 @@ public class GeonetworkRequestDecoder {
|
|||
}else
|
||||
scope = request;
|
||||
|
||||
return new GeonetworkRequestCriteria("/"+scope.replaceAll("_", "/"), filterPublicIds, authOnGN);
|
||||
return new GeonetworkRequestCriteria("/"+scope.replaceAll("\\"+SCOPE_SEPARATOR, "/"), filterPublicIds, authOnGN);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class GeonetworkQueryTest {
|
|||
|
||||
private String[] scopes = {"/gcube/devsec"};
|
||||
|
||||
private String[] scopesProd = {"/d4science.research-infrastructures.eu"};
|
||||
private String[] scopesProd = {"/d4science.research-infrastructures.eu/gCubeApps"};
|
||||
|
||||
private LoginLevel loginLevel = LoginLevel.CKAN;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class GeonetworkQueryTest {
|
|||
|
||||
// req.addParam("keyword", "Thredds");
|
||||
final GNSearchRequest req=new GNSearchRequest();
|
||||
req.addParam(GNSearchRequest.Param.any,"Thredds");
|
||||
// req.addParam(GNSearchRequest.Param.any,"");
|
||||
GNSearchResponse resp = reader.query(req);
|
||||
int publicCount= resp.getCount();
|
||||
int totalCount=resp.getCount();
|
||||
|
@ -76,7 +76,7 @@ public class GeonetworkQueryTest {
|
|||
GeoNetworkReader reader=GeoNetwork.get();
|
||||
final GNSearchRequest req=new GNSearchRequest();
|
||||
// req.addParam("keyword", "Thredds");
|
||||
req.addParam(GNSearchRequest.Param.any,"Thredds");
|
||||
req.addParam(GNSearchRequest.Param.any,"Oscar");
|
||||
int publicCount=reader.query(req).getCount();
|
||||
reader.login(loginLevel);
|
||||
int totalCount=reader.query(req).getCount();
|
||||
|
|
|
@ -17,7 +17,7 @@ public class GeonetworkRequestDecoderTest {
|
|||
|
||||
//@Test
|
||||
public void test1() throws ServletException{
|
||||
String request = "/geonetwork/gcube_devsec_devVRE#filterpublicids";
|
||||
String request = "/geonetwork/gcube|devsec|devVRE#filterpublicids";
|
||||
System.out.println("Testing request: "+request);
|
||||
GeonetworkRequestDecoder gd = new GeonetworkRequestDecoder(request,"");
|
||||
System.out.println(gd);
|
||||
|
@ -25,7 +25,7 @@ public class GeonetworkRequestDecoderTest {
|
|||
|
||||
//@Test
|
||||
public void test2() throws ServletException{
|
||||
String request = "/geonetwork/gcube_devsec_devVRE#noauthentication";
|
||||
String request = "/geonetwork/gcube|devsec|devVRE#noauthentication";
|
||||
System.out.println("Testing request: "+request);
|
||||
GeonetworkRequestDecoder gd = new GeonetworkRequestDecoder(request,"");
|
||||
System.out.println(gd);
|
||||
|
@ -34,7 +34,7 @@ public class GeonetworkRequestDecoderTest {
|
|||
|
||||
@Test
|
||||
public void test3() throws ServletException{
|
||||
String request = "/gcube_devsec";
|
||||
String request = "/geonetwork/gcube|devsec#filterpublicids";
|
||||
System.out.println("Testing request: "+request);
|
||||
GeonetworkRequestDecoder gd = new GeonetworkRequestDecoder(request,"");
|
||||
System.out.println(gd);
|
||||
|
|
Loading…
Reference in New Issue