users@jersey.java.net

[Jersey] Re: Migrating to more RESTful API

From: algermissen1971 <algermissen1971_at_mac.com>
Date: Wed, 18 May 2011 06:05:33 +0000 (GMT)

On 18 May, 2011,at 07:44 AM, algermissen1971 <algermissen1971_at_mac.com> wrote:

>> I would like to fix this in a backward compatible way. I'm not firm on the new URL - but say it's ws/users/{userid}/config/savedCriteria.
>>
>> When an older client makes a request to ws/savedCriteria with an authenticated user = foouser, should I return a 301 with ws/users/foouser/config/savedCriteria? Every distinct user who requests ws/savedCriteria will be redirected to a different URL, so a "Moved Permanently" seems not quite right.
>
> Why not? The redirect is permanent for this authenticated user. 301 is fine.
 
Uuhh - my bad. I have to correct that.

301 responses can be cached - so thi is probably not the best idea.

You could mark the response as non-cacheable .. but this is semantically not quite right either then.



Actually, if your older clients do adhere the hypermedia constraint they would not simply remember this URI but discover it. In that case, they would discover the new URI and all would be fine.

Are the older clients programmed this way?

Jan



>
>
> Jan
>
>
>
>
>
>
> However, 302 implies moved temporarily, which is also wrong. 303 looks technically correct since the RFC says, "The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable." However, I have never seen 303 used this way.
>>
>> Does anyone have any thoughts on this?
>>