Add Uri::toRelative(base: Uri): Uri
method
#99
Labels
1 - triaged
Tickets that are safe to pick up for contributing in terms of likeliness of being accepted
help wanted
Identifies issues that the core team will likely not have time to work on
nice-to-have (low-prio)
Tasks which make sense, however are not very high priority, feel free to help out!
Milestone
Issue by bblfish
Friday Jul 04, 2014 at 09:08 GMT
Originally opened as akka/akka#15495
I reported this as Spray issue 818 as the move to akka was underway. So I'll add a reference here.
Currently one can make a Uri relative to the root.
It would be useful to have the same functionality as java.net.URI#relativize(URI) to allow easy relative URI creation.
It is often very useful to serialise to relative uris when a base is known. So when one does a GET on
a URI such as http://bblfish.net/people/henry/card it is much easier to read the result when it says
rather than writing out all the Uris in full. Because a relative URI such as "" ( or <> and in the above ) allows a human to immediatly understand that the document is speaking of itself. A full URI requires a human to do a full comparison.
So we need this a lot in serialisations. Having this feature would allow banana-rdf for example to move totally to akka-http, which would also make it easier then to write code that can compile with scala-js.
As a matter of interest I wonder if it would be possible to make type distinctions between full and relative Uris. (Full Uris being a subclass of relative Uris perhaps). This would help make a large class of errors visible to the compiler, as explained in issue #41 of banana-rdf. Perhaps that should be for a different bug report?
The text was updated successfully, but these errors were encountered: