Loading src/main/java/it/inaf/oats/vospace/BaseNodeController.java +13 −12 Original line number Diff line number Diff line package it.inaf.oats.vospace; import it.inaf.oats.vospace.datamodel.NodeUtils; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; Loading @@ -8,20 +9,20 @@ public abstract class BaseNodeController { @Autowired 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() { String requestURL = servletRequest.getRequestURL().toString(); String[] split = requestURL.split("/nodes/"); String path = "/"; if (split.length == 2) { path += split[1]; return NodeUtils.getPathFromRequestURLString(requestURL); } return path; protected String getParentPath(String path) { return NodeUtils.getParentPath(path); } } Loading
src/main/java/it/inaf/oats/vospace/BaseNodeController.java +13 −12 Original line number Diff line number Diff line package it.inaf.oats.vospace; import it.inaf.oats.vospace.datamodel.NodeUtils; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; Loading @@ -8,20 +9,20 @@ public abstract class BaseNodeController { @Autowired 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() { String requestURL = servletRequest.getRequestURL().toString(); String[] split = requestURL.split("/nodes/"); String path = "/"; if (split.length == 2) { path += split[1]; return NodeUtils.getPathFromRequestURLString(requestURL); } return path; protected String getParentPath(String path) { return NodeUtils.getParentPath(path); } }