org.apache.olingo.server.api.etag

## Interface ETagHelper

-     public interface ETagHelper

  Used for ETag-related tasks.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    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.

- - ### Method Detail

    - #### checkReadPreconditions

          boolean checkReadPreconditions(String eTag,
                                         Collection<String> ifMatchHeaders,
                                         Collection<String> ifNoneMatchHeaders)
                                  throws PreconditionException

      Checks 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`.

      Parameters:
        `eTag` - the ETag value to match
        `ifMatchHeaders` - the If-Match header values
        `ifNoneMatchHeaders` - the If-None-Match header values
      Returns:
        whether a "Not Modified" response should be used
      Throws:
        `PreconditionException`

    - #### checkChangePreconditions

          void checkChangePreconditions(String eTag,
                                        Collection<String> ifMatchHeaders,
                                        Collection<String> ifNoneMatchHeaders)
                                 throws PreconditionException

      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.

      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`.

      Parameters:
        `eTag` - the ETag value to match
        `ifMatchHeaders` - the If-Match header values
        `ifNoneMatchHeaders` - the If-None-Match header values
      Throws:
        `PreconditionException`

Copyright © 2013–2020 The Apache Software Foundation. All rights reserved.