Class ETagHelperImpl

java.lang.Object
org.apache.olingo.server.core.etag.ETagHelperImpl
All Implemented Interfaces:
ETagHelper

public class ETagHelperImpl extends Object implements ETagHelper
  • Constructor Details

    • ETagHelperImpl

      public ETagHelperImpl()
  • Method Details

    • checkReadPreconditions

      public boolean checkReadPreconditions(String eTag, Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) throws PreconditionException
      Description copied from interface: ETagHelper

      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.

      Specified by:
      checkReadPreconditions in interface ETagHelper
      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

      public void checkChangePreconditions(String eTag, Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) throws PreconditionException
      Description copied from interface: ETagHelper

      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.

      Specified by:
      checkChangePreconditions in interface ETagHelper
      Parameters:
      eTag - the ETag value to match
      ifMatchHeaders - the If-Match header values
      ifNoneMatchHeaders - the If-None-Match header values
      Throws:
      PreconditionException
    • createETagInformation

      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.
      Parameters:
      values - the collection of header values
      Returns:
      an ETagInformation instance