-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Currently we throw an exception when the client cannot discover a shapetree metadata auxiliary resource advertised by the solid server. Should clients gracefully handle these cases? Options would be:
- Don't do any validation at all - act like a normal client
- Use an alternative location, such as a general metadata auxiliary resource... Given the fact that our logic relies on the server providing link relations to locators, I'm not sure this would be feasible. If the server could be configured to do that, it could be configured to just do it properly in the first place.
- Halt and catch fire
@NotNull
public String getMetadataURI() throws IOException {
if (!this.parsedLinkHeaders.containsKey(LinkRelations.SHAPETREE_LOCATOR.getValue())) {
log.error("The resource {} does not contain a link header of {}", this.getUri(), LinkRelations.SHAPETREE_LOCATOR.getValue());
// TODO: Should this be gracefully handled by the client?
throw new ShapeTreeException(500, "No Link header with relation of " + LinkRelations.SHAPETREE_LOCATOR.getValue() + " found");
}
String metaDataURIString = this.parsedLinkHeaders.get(LinkRelations.SHAPETREE_LOCATOR.getValue()).stream().findFirst().orElse(null);
if (metaDataURIString != null && metaDataURIString.startsWith("/")) {
// If the header value doesn't include scheme/host, prefix it with the scheme & host from container
URI shapeTreeContainerURI = this.getUri();
String portFragment;
if (shapeTreeContainerURI.getPort() > 0) {
portFragment = ":" + shapeTreeContainerURI.getPort();
} else {
portFragment = "";
}
metaDataURIString = shapeTreeContainerURI.getScheme() + "://" + shapeTreeContainerURI.getHost() + portFragment + metaDataURIString;
}
if (metaDataURIString == null) {
throw new ShapeTreeException(500, "No Link header with relation of " + LinkRelations.SHAPETREE_LOCATOR.getValue() + " found");
}
return metaDataURIString;
}Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested