Nam Nguyen wrote:
>> If you have a resource whose template is "customers/" and you don't
>> have one whose template is "customers" then both URIs will result in
>> the same resource - i.e. a request for "customers" will redirect to
>> "customers/". Conversely, if you have a resource whose template is
>> "customers" and you don't have one whose template is "customers/" then
>> a request for "customers/" will give you a 404, i.e. it won't redirect
>> to "customers".
>>
>> The above is in line with the way lots of web sites work so hopefully
>> it will be fairly intuitive for developers.
> OK, basically it is recommended to have ending '/' for all resources,
> even those without sub-resources (non-container).
>
It is common for resources with sub-resources (.e.g directories), i have
not seen it that much for a leaf resource, and of course such paths to a
file would not work with UNIX files systems.
A dirty little secret: although for the most part URIs are meant to be
opaque to the client (unless otherwise specified by the server) users
modify URIs all the time with the browser (at least i do), and may
forgot (or not know) to add a slash or remove a slash when truncating a
path.
For example, take Hudson's URI path for a particular build:
/job/Jersey/35/
Sometimes i edit this in the URI and change the build number by hand:
/job/Jersey/34
And hudson does the right thing and redirects to:
/job/Jersey/34/
But the following:
/job/Jersey/35/console
does not redirect (because it contains no sub-resources).
Paul.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109