Class EtagUtils
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe separator within an etag used to indicate a compressed variant. - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeWeakEtag(Path path) Compute the weak etag for the providedPathreference.static StringcomputeWeakEtag(Path path, String suffix) Compute the weak etag for the providedPathreference.static StringcomputeWeakEtag(Resource resource) Compute the weak etag for the providedResourcereference.static StringcomputeWeakEtag(Resource resource, String etagSuffix) Compute the weak etag for the providedResourcereference.static HttpFieldcreateWeakEtagField(Resource resource) Create a newHttpFieldHttpHeader.ETAGfield suitable to represent the provided Resource.static HttpFieldcreateWeakEtagField(Resource resource, String etagSuffix) Create a newHttpFieldHttpHeader.ETAGfield suitable to represent the provided Resource.static booleanTest if the given Etag is considered strong (not weak).static booleanTest if the given Etag is considered weak.static booleanTest if etag matches against an etagWithOptionalSuffix.static StringrewriteWithSuffix(String etag, String newSuffix) Rewrite etag with a new suffix, satisfying quoting rules, and preserving optional weak flag. 
- 
Field Details
- 
ETAG_SEPARATOR
The separator within an etag used to indicate a compressed variant.
Default separator is
--Adding a suffix of
gzipto an etag ofW/"28c772d6"will result inW/"28c772d6--gzip"The separator may be changed by the
org.eclipse.jetty.http.EtagUtil.ETAG_SEPARATORSystem property. If changed, it should be changed to a string that will not be found in a normal etag or at least is very unlikely to be a substring of a normal etag. 
 - 
 - 
Method Details
- 
createWeakEtagField
Create a newHttpFieldHttpHeader.ETAGfield suitable to represent the provided Resource.- Parameters:
 resource- the resource to represent with an Etag.- Returns:
 - the field if possible to create etag, or null if not possible.
 
 - 
createWeakEtagField
Create a newHttpFieldHttpHeader.ETAGfield suitable to represent the provided Resource.- Parameters:
 resource- the resource to represent with an Etag.etagSuffix- the suffix for the etag- Returns:
 - the field if possible to create etag, or null if not possible.
 
 - 
computeWeakEtag
Compute the weak etag for the providedResourcereference.Will use the
Resource.getPath()if the resource provides it, otherwise it will use theResourceprovided details fromResource.getName(),Resource.lastModified(), andResource.length()to build the ETag.- Parameters:
 resource- the resource to calculate etag from- Returns:
 - the weak etag
 
 - 
computeWeakEtag
Compute the weak etag for the providedResourcereference.Will use the
Resource.getPath()if the resource provides it, otherwise it will use theResourceprovided details fromResource.getName(),Resource.lastModified(), andResource.length()to build the ETag.- Parameters:
 resource- the resource to calculate etag frometagSuffix- the suffix for the etag- Returns:
 - the weak etag
 
 - 
computeWeakEtag
 - 
computeWeakEtag
 - 
rewriteWithSuffix
 - 
isWeak
Test if the given Etag is considered weak.- Parameters:
 etag- the etag to test- Returns:
 - true if weak.
 
 - 
isStrong
Test if the given Etag is considered strong (not weak).- Parameters:
 etag- the etag to test- Returns:
 - true if strong (not weak).
 
 - 
matches
Test if etag matches against an etagWithOptionalSuffix.
- Parameters:
 etag- An etag without a compression suffixetagWithOptionalSuffix- An etag optionally with a compression suffix.- Returns:
 - True if the tags are equal.
 - See Also:
 
 
 -