def conditional(eTag: EntityTag): Directive0 def conditional(lastModified: DateTime): Directive0 def conditional(eTag: EntityTag, lastModified: DateTime): Directive0 def conditional(eTag: Option[EntityTag], lastModified: Option[DateTime]): Directive0
Wraps its inner route with support for Conditional Requests as defined by http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26.
Depending on the given
lastModified values this directive immediately responds with
304 Not Modified or
412 Precondition Failed (without calling its inner route) if the request comes with the respective conditional headers. Otherwise the request is simply passed on to its inner route.
Since this directive requires the
lastModified time stamp for the resource as concrete arguments it is usually used quite deep down in the route structure (i.e. close to the leaf-level), where the exact resource targeted by the request has already been established and the respective ETag/Last-Modified values can be determined.
The FileAndResourceDirectives internally use the
conditional directive for ETag and Last-Modified support (if the
akka.http.routing.file-get-conditional setting is enabled).