Completed working on

[Task #6119] Provide CatalogueResolver: get/resolve a link to a CKAN Entity

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@139765 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-12-07 13:22:56 +00:00
parent a3d3a9f709
commit 4516dff1ed
3 changed files with 42 additions and 25 deletions

View File

@ -86,7 +86,12 @@ public class UriResolverRewriteFilter implements Filter{
logger.debug("is a catalogue request"); logger.debug("is a catalogue request");
int lastSlash = requestURI.lastIndexOf(PATH_SEPARATOR); int lastSlash = requestURI.lastIndexOf(PATH_SEPARATOR);
String toCatalogueLink = requestURI.substring(lastSlash + 1, requestURI.length()); String toCatalogueLink = requestURI.substring(lastSlash + 1, requestURI.length());
String newURI = SERVLET_CATALOGUE + "?" + PARAMETER_CATALOGUE_LINK + "=" + toCatalogueLink; HttpServletRequest request = (HttpServletRequest) req;
String newURI = SERVLET_CATALOGUE;
logger.debug("method is: "+request.getMethod());
if(request.getMethod().compareTo("GET")==0)
newURI+= "?" + PARAMETER_CATALOGUE_LINK + "=" + toCatalogueLink;
logger.debug("forward to: " + newURI); logger.debug("forward to: " + newURI);
multiReadRequest.getRequestDispatcher(newURI).forward(multiReadRequest, response); multiReadRequest.getRequestDispatcher(newURI).forward(multiReadRequest, response);
//chain.doFilter(multiReadRequest, response); //chain.doFilter(multiReadRequest, response);

View File

@ -384,28 +384,4 @@ public class CatalogueResolver extends HttpServlet{
return s; return s;
} }
} }
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(String[] args) {
// jsonRequest = "{" +
// "\"gcube_scope\" : \"/gcube\"," +
// "\"entity_context\" : \"dataset\"," +
// "\"entity_name\" : \"sarda-sarda\"" +
// "}";
// //String test = "{" +
// // "\"gcube_scope\" : \"/gcube\"," +
// // "\"entity_context\" : \"dataset\"," +
// // "\"entity_name\" : \"sarda-sarda\"," +
// // "\"query\" : {\"key1\" : \"value1\", \"key2\":\"value2\"}" +
//
//
// // "}";
}
} }

View File

@ -0,0 +1,36 @@
/**
*
*/
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 7, 2016
*/
public class CatalogueResolverTest {
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(String[] args) {
// jsonRequest = "{" +
// "\"gcube_scope\" : \"/gcube\"," +
// "\"entity_context\" : \"dataset\"," +
// "\"entity_name\" : \"sarda-sarda\"" +
// "}";
// //String test = "{" +
// // "\"gcube_scope\" : \"/gcube\"," +
// // "\"entity_context\" : \"dataset\"," +
// // "\"entity_name\" : \"sarda-sarda\"," +
// // "\"query\" : {\"key1\" : \"value1\", \"key2\":\"value2\"}" +
//
//
// // "}";
}
}