简体   繁体   English

何时在 ServerResource 中使用 setConditional 方法

[英]When to use setConditional method in ServerResource

I am going through restlet documentation and came across the method ServerResource.setConditional(boolean ) .我正在浏览 restlet 文档并遇到了方法ServerResource.setConditional(boolean )

The document explains it as :该文件将其解释为:

Indicates if conditional handling is enabled.指示是否启用条件处理。 The default value is true.默认值是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.我对 Jersey API 有一些了解,但从未在那里遇到过这样的选项。

Conditional handling in Restlet corresponds to the support of the following headers: Restlet 中的条件处理对应于以下头文件的支持:

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

Here is a sample of use with the If-None-Match header:以下是使用If-None-Match标头的示例:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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