简体   繁体   中英

When to use setConditional method in ServerResource

I am going through restlet documentation and came across the method ServerResource.setConditional(boolean ) .

The document explains it as :

Indicates if conditional handling is enabled. The default value is true.

Can someone please explain with a simple example when it is useful and what is the purpose of it? I have some knowledge on Jersey API but never came across such option there.

Conditional handling in Restlet corresponds to the support of the following headers:

  • If-Match ( request.conditions.match )
  • If-Modified-Since ( request.conditions.modifiedSince )
  • If-None-Match (request.conditions.noneMatch`)
  • If-Range ( request.conditions.rangeTag and rangeDate )
  • If-Unmodified-Since ( request.conditions.unmodifiedSince )

Here is a sample of use with the If-None-Match header:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM