EntityTagVersion

data class EntityTagVersion : Version

This version checks etag value and pass it through conditions supplied by the remote client. Depending on conditions it produces return value of enum type VersionCheckResult

It never handles If-None-Match: * as it is related to non-etag logic (for example, Last modified checks). See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26 for more details

Parameters

etag -

weak -

Return VersionCheckResult.OK if all headers pass or there was no related headers, VersionCheckResult.NOT_MODIFIED for successful If-None-Match, VersionCheckResult.PRECONDITION_FAILED for failed If-Match

Constructors

<init>

EntityTagVersion(etag: String)
EntityTagVersion(etag: String, weak: Boolean)

This version checks etag value and pass it through conditions supplied by the remote client. Depending on conditions it produces return value of enum type VersionCheckResult

Properties

etag

val etag: String
  • entity tag, for example file’s content hash

weak

val weak: Boolean
  • whether strong or weak validation should be applied

Functions

appendHeadersTo

fun appendHeadersTo(builder: HeadersBuilder): Unit

Appends relevant headers to the builder

check

fun check(requestHeaders: Headers): VersionCheckResult

Checks requestHeaders against this version and returns VersionCheckResult

match

fun match(other: EntityTagVersion): Boolean

Examine two entity-tags for match (strong).

fun match(
    givenMatchEtags: List<EntityTagVersion>
): VersionCheckResult

If-Match logic using match function.

noneMatch

fun noneMatch(
    givenNoneMatchEtags: List<EntityTagVersion>
): VersionCheckResult

If-None-Match logic using match function.

Companion Object Properties

STAR

Instance for * entity-tag pattern.

Companion Object Functions

parse

fun parse(headerValue: String): List<EntityTagVersion>

Parse headers with a list of entity-tags. Useful for headers such as If-Match/If-None-Match.

parseSingle

fun parseSingle(value: String): EntityTagVersion

Parse single entity-tag or pattern specification.