I am trying to send a conditional PUT to a Restlet resource using the 
'If-None-Match: *' header, basically I need the PUT to succeed if no entity 
exists and to fail if it does exist (see 
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26). The current 
behavior of Restlet appears to be the opposite.

Within ServerResource.doConditionalHandle() if the resource does not exist 
resultInfo ends up null so Conditions.getStatus(...) is never consulted and a 
404 is returned.

When the resource does exist resultInfo is non-null and 
Conditions.getStatus(...) is invoked. The If-None-Match rule if (Conditions 
line #273) then enters the entityExists if block, but since my entity tag is 
null 'matched' is left as false even though the existence of the entity should 
cause a match when '*' is specified, as stated in the spec: "the method MUST 
NOT be performed if the representation selected by the origin server (or by a 
cache, possibly using the Vary mechanism, see section 14.44) exists." Since 
matched is left as false the PUT is allowed to proceed, overwriting the 
previously existing resource.

Also as a side note, within the If-None-Match rule if the entity does not exist 
(entityExists = false) matched is set to 
'getNoneMatch().get(0).equals(Tag.ALL)', whereas it should remain false.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2449400

Reply via email to