-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflicts in URI paths #1
Comments
I had another look at this, and I’m now proposing the following steps:
Functions with an identical specifity will only raise an error if they have the same constraints, and are chosen as return candidates. As a proof of concept, I have now implemented this in BaseX (works fine). As my proposal might indicate, I’m not a native speaker, so… Feel free to revise my wording! |
Good to know (quoted from @apb2006): “The JAX-RS solution "The request is dispatched to the first Java method in the set" see section 3.7.2 http://jsr311.java.net/nonav/releases/1.0/spec/index.html#x3-340003.7.2” |
Christian, I think your second comment above is really great, and I will adopt if almost in its entirety for the spec. In eXist-db I actually implement part 1, 2a and 3 already. Part 2b is really nice though and I will certainly implement that, thanks. Regards Part 4, I think there can also be a static error as well as a dynamic error, as in some cases, when you register a Resource Function with the Service Registry, I think you can compare all known Resource Function Constraints (e.g. Paths) and find conflicts, you could then reject the registration. Of course we would need the dynamic error at Request time as well for Resource Function Constraints that are impossible to find conflicts on without looking at the Request. |
As this is pretty clear cut, I have added this to the TODO Wiki Page |
Just in case: this is how I've implemented the function selection in BaseX: https://github.com/BaseXdb/basex-api/blob/master/src/main/java/org/basex/http/restxq/RestXqModules.java#L38 All function candidates are sorted by their specifity (using |
As the specification indicates, conflicts may occur when many URI paths are defined. I think it would be useful to make it definite what happens in such a case. Here’s a suggestion how an implementation could proceed:
Below, all 2^3 variants for URIs for three segments are listed by their specifity:
I'm not that lucky about the wording yet; maybe it would help to map the behavior to pseudo-code. We could also check out what the JAX-RS API says about this, or how the JAX-RS Jersey implementation behaves for competing paths. – What do you think?
The text was updated successfully, but these errors were encountered: