Skip to content
Snippets Groups Projects
Commit bb87abe9 authored by Sara Bertocco's avatar Sara Bertocco
Browse files

working on re-engineering due to task #3635 - Refactoring: create NodeUtils class

parent a1a843a3
No related branches found
No related tags found
No related merge requests found
Pipeline #954 failed
package it.inaf.oats.vospace; package it.inaf.oats.vospace;
import it.inaf.oats.vospace.datamodel.NodeUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -8,20 +9,20 @@ public abstract class BaseNodeController { ...@@ -8,20 +9,20 @@ public abstract class BaseNodeController {
@Autowired @Autowired
private HttpServletRequest servletRequest; private HttpServletRequest servletRequest;
/**
* Slash is a special character in defining REST endpoints and trying to
* define a PathVariable containing slashes doesn't work, so the endpoint
* has been defined using "/nodes/**" instead of "/nodes/{path}" and the
* path is extracted manually parsing the request URL.
*/
protected String getPath() { protected String getPath() {
String requestURL = servletRequest.getRequestURL().toString(); String requestURL = servletRequest.getRequestURL().toString();
String[] split = requestURL.split("/nodes/");
String path = "/"; return NodeUtils.getPathFromRequestURLString(requestURL);
if (split.length == 2) {
path += split[1];
} }
return path;
protected String getParentPath(String path) {
return NodeUtils.getParentPath(path);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment