Jerome,


I understand If-Match, but I'm still confused by ServerResource's support of it in conditional mode. Logically, POST and PUT should work even if there is no entity, right?


Right now, my GET returns an error status because there is no entity, but then I can't get POST/PUT to work while in conditional mode because of that. No entity, no possibility of checking conditions... which doesn't make sense to me.


It seems to me that if GET doesn't return a value, then POST and PUT should continue as normal in conditional mode. Could the problem be that I'm setting an error status? But, then, I do need to set an error status for true failures of GET...


I'm still confused!


-Tal


Jerome Louvel wrote:

Hi Tal,
 
The conditional mode is here to support HTTP conditional methods as explained for the "If-Match" header:
 
The idea is that before executing some methods (PUT, POST, etc.), it is possible to check whether the resource state has changed (tag or date comparison). This check has to be done on the entity that would have been returned by an equivalent GET. So we have to simulate a GET in order to check conditions, whatever is the actual method handled.
 
Now, there is no reason to simulate the GET if the client hasn't expressed any condition. I have fixed ServerResource#doConditionalHandle() so it will work fine in your cases.
 
Just note that if your client do express some conditions, the ServerResource will expect your subclasses to provide support for GET or else it will result in an error. I think this is reasonable and you can always turn off conditional processing if you really don't want to provide GET implementation.
 
Hope this clarifies.
 
Best regards,
Jerome
Louvel
--
Restlet ~ Founder and Lead developer ~
http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com
 


De : Tal Liron [mailto:[email protected]]
Envoyé : jeudi 2 avril 2009 23:20
À : [email protected]
Objet : ServerResource conditional mode

Hi,


Does someone have a grasp on what conditional mode is for and how it used?


It's enabled by default, but I had to disable it for one of my resources to work with PUT and POST. The issue is that it always calls doGetInfo first, which for my particular resource will fail, and so calls to PUT and POST also fail.

Also, it seems to me that calling doGetInfo for every request, even for methods that are not GET, is wasteful. In short, I simply don't understand why this check happens, and subsequently what exactly conditional mode is doing. :)

-Tal

Reply via email to