Loading src/main/java/it/inaf/oats/vospace/BaseNodeController.java +19 −8 Original line number Diff line number Diff line Loading @@ -48,13 +48,24 @@ public abstract class BaseNodeController { } protected void validateInternalLinkNode(LinkNode linkNode) { protected void validateLinkNode(LinkNode linkNode) { String target = linkNode.getTarget(); // I validate it here to add context easily if (target == null) { throw new InvalidArgumentException("LinkNode in payload has no target element specified"); } if (URIUtils.isURIInternal(target)) { URIUtils.returnVosPathFromNodeURI(linkNode.getTarget(), authority); } else { // Let's discuss if we need to combine this validation with // protocol endpoints management (URIService, ProtocolType) // Let's start with http and https only for now if (!(target.toLowerCase().startsWith("http://") || target.toLowerCase().startsWith("https://"))) { throw new InvalidArgumentException("LinkNode target malformed or unsupported protocol: " + target); } } } } src/main/java/it/inaf/oats/vospace/CreateNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class CreateNodeController extends BaseNodeController { private void validateInputNode(Node node) { if (node instanceof LinkNode) { this.validateInternalLinkNode((LinkNode) node); this.validateLinkNode((LinkNode) node); } } Loading src/main/java/it/inaf/oats/vospace/SetNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class SetNodeController extends BaseNodeController { if (node instanceof DataNode) { checkViews((DataNode) node, (DataNode) toBeModifiedNode); } else if(node instanceof LinkNode) { this.validateInternalLinkNode((LinkNode) node); this.validateLinkNode((LinkNode) node); } //The service SHOULD throw a HTTP 500 status code including an InternalFault fault Loading Loading
src/main/java/it/inaf/oats/vospace/BaseNodeController.java +19 −8 Original line number Diff line number Diff line Loading @@ -48,13 +48,24 @@ public abstract class BaseNodeController { } protected void validateInternalLinkNode(LinkNode linkNode) { protected void validateLinkNode(LinkNode linkNode) { String target = linkNode.getTarget(); // I validate it here to add context easily if (target == null) { throw new InvalidArgumentException("LinkNode in payload has no target element specified"); } if (URIUtils.isURIInternal(target)) { URIUtils.returnVosPathFromNodeURI(linkNode.getTarget(), authority); } else { // Let's discuss if we need to combine this validation with // protocol endpoints management (URIService, ProtocolType) // Let's start with http and https only for now if (!(target.toLowerCase().startsWith("http://") || target.toLowerCase().startsWith("https://"))) { throw new InvalidArgumentException("LinkNode target malformed or unsupported protocol: " + target); } } } }
src/main/java/it/inaf/oats/vospace/CreateNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class CreateNodeController extends BaseNodeController { private void validateInputNode(Node node) { if (node instanceof LinkNode) { this.validateInternalLinkNode((LinkNode) node); this.validateLinkNode((LinkNode) node); } } Loading
src/main/java/it/inaf/oats/vospace/SetNodeController.java +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class SetNodeController extends BaseNodeController { if (node instanceof DataNode) { checkViews((DataNode) node, (DataNode) toBeModifiedNode); } else if(node instanceof LinkNode) { this.validateInternalLinkNode((LinkNode) node); this.validateLinkNode((LinkNode) node); } //The service SHOULD throw a HTTP 500 status code including an InternalFault fault Loading