Support for Matrix URIs #4065
Description
Support for Matrix URIs
With a small change it is possible to support Matrix URIs in $resource (What is a matrix uri? See doc at the end of this request).
http://www.example.com/poi/lat=50;long=20;rad=32000/term
The only problem is that semicolons are encoded in $resource.
$resource('http://www.example.com/poi/:geo/term', {
geo: 'lat=50;long=20;rad=32000'
});
// return http://www.example.com/poi/lat=50%3Blong=20%3Brad=32000/term
Change
A change in function encodeUriSegment
would solve the problem.
function encodeUriSegment(val) {
return encodeUriQuery(val, true).
replace(/%26/gi, '&').
replace(/%3B/gi, ';'). //added this line
replace(/%3D/gi, '=').
replace(/%2B/gi, '+');
}
Objections
Are there any objections to don't support this? Security, backwards compatible, etc.
If there are. Is there a way to implement a kind of replace-list?
Doc
http://www.w3.org/DesignIssues/MatrixURIs.html
and
https://tools.ietf.org/html/rfc3986#section-3.3
Aside from dot-segments in hierarchical paths, a path segment is
considered opaque by the generic syntax. URI producing applications
often use the reserved characters allowed in a segment to delimit
scheme-specific or dereference-handler-specific subcomponents. For
example, the semicolon (";") and equals ("=") reserved characters are
often used to delimit parameters and parameter values applicable to
that segment. The comma (",") reserved character is often used for
similar purposes. For example, one URI producer might use a segment
such as "name;v=1.1" to indicate a reference to version 1.1 of
"name", whereas another might use a segment such as "name,1.1" to
indicate the same. Parameter types may be defined by scheme-specific
semantics, but in most cases the syntax of a parameter is specific to
the implementation of the URI's dereferencing algorithm.