public class ETagHelperImpl extends Object implements ETagHelper
| Constructor and Description |
|---|
ETagHelperImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkChangePreconditions(String eTag,
Collection<String> ifMatchHeaders,
Collection<String> ifNoneMatchHeaders)
Checks the preconditions of a change request (with HTTP methods PUT, PATCH, or DELETE)
with a given ETag value against the If-Match and If-None-Match HTTP headers.
|
boolean |
checkReadPreconditions(String eTag,
Collection<String> ifMatchHeaders,
Collection<String> ifNoneMatchHeaders)
Checks the preconditions of a read request with a given ETag value
against the If-Match and If-None-Match HTTP headers.
|
protected ETagInformation |
createETagInformation(Collection<String> values)
Creates ETag information from the values of a HTTP header
containing a list of entity tags or a single star character, i.e.,
If-Match and If-None-Match. |
public boolean checkReadPreconditions(String eTag, Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) throws PreconditionException
ETagHelperChecks the preconditions of a read request with a given ETag value against the If-Match and If-None-Match HTTP headers.
If the given ETag value is not matched by the ETag information in the If-Match headers, and there are ETags in the headers to be matched, a "Precondition Failed" exception is thrown.
If the given ETag value is matched by the ETag information in the If-None-Match headers,
true is returned, and applications are supposed to return an empty response
with a "Not Modified" status code and the ETag header, false otherwise.
All matching uses weak comparison as described in RFC 7232, section 2.3.2.
This method does not nothing and returns false if the ETag value is
null.
checkReadPreconditions in interface ETagHelpereTag - the ETag value to matchifMatchHeaders - the If-Match header valuesifNoneMatchHeaders - the If-None-Match header valuesPreconditionExceptionpublic void checkChangePreconditions(String eTag, Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) throws PreconditionException
ETagHelperChecks the preconditions of a change request (with HTTP methods PUT, PATCH, or DELETE) with a given ETag value against the If-Match and If-None-Match HTTP headers.
If the given ETag value is not matched by the ETag information in the If-Match headers, and there are ETags in the headers to be matched, or if the given ETag value is matched by the ETag information in the If-None-Match headers, a "Precondition Failed" exception is thrown.
All matching uses weak comparison as described in RFC 7232, section 2.3.2.
This method does not nothing if the ETag value is null.
checkChangePreconditions in interface ETagHelpereTag - the ETag value to matchifMatchHeaders - the If-Match header valuesifNoneMatchHeaders - the If-None-Match header valuesPreconditionExceptionprotected ETagInformation createETagInformation(Collection<String> values)
If-Match and If-None-Match.values - the collection of header valuesETagInformation instanceCopyright © 2023. All rights reserved.