Sets the ETag value.

@param string|null $eTag The ETag unique identifier or null to remove the header
@param bool $weak Whether you want a weak ETag or not

@return Response
433096
public function withETag($eTag = null, $weak = false)
    {
        $this->withoutHeader('ETag');
        $this->withHeader('ETag', (true === $weak ? 'W/' : '') . $eTag);

        return $this;
    }
632120
protected void checkCache(final Instant modified, final EntityTag etag) {
        HttpUtils.checkIfMatch(getRequest().getHeaders().getFirst(IF_MATCH), etag);
        HttpUtils.checkIfUnmodifiedSince(getRequest().getHeaders().getFirst(IF_UNMODIFIED_SINCE), modified);
        HttpUtils.checkIfNoneMatch(getRequest().getMethod(), getRequest().getHeaders().getFirst(IF_NONE_MATCH), etag);
        HttpUtils.checkIfModifiedSince(getRequest().getMethod(), getRequest().getHeaders().getFirst(IF_MODIFIED_SINCE),
                modified);
    }
802717
func (s *Item) SetETag(v string) *Item {
	s.ETag = &v
	return s
}
571545
def build_etag(self, response, include_etag=True, **kwargs):
        
        if not include_etag:
            return

        if not spooky:
            # use built-in md5
            response.add_etag()
            return

        # use spooky
        response.headers["ETag"] = quote_etag(
            hexlify(
                spooky.hash128(
                    response.get_data(),
                ).to_bytes(16, "little"),
            ).decode("utf-8"),
        )
806658
def contains_raw(self, etag):
        """"""
        etag, weak = unquote_etag(etag)
        if weak:
            return self.contains_weak(etag)
        return self.contains(etag)
1307426
public function set($data = null)
    {
        $this->server = isset($data) ? $data : $_SERVER;
        return $this;
    }
355713
func (s *GetFieldLevelEncryptionOutput) SetETag(v string) *GetFieldLevelEncryptionOutput {
	s.ETag = &v
	return s
}
1135764
func (s *CreateDistributionWithTagsOutput) SetETag(v string) *CreateDistributionWithTagsOutput {
	s.ETag = &v
	return s
}
594102
func (s *GetCloudFrontOriginAccessIdentityOutput) SetETag(v string) *GetCloudFrontOriginAccessIdentityOutput {
	s.ETag = &v
	return s
}
1021782
def etag(self, etag):
        
        if not isinstance(etag, bytes):
            etag = bytes(etag, "utf-8")
        self._etag.append(etag)
210743
public function getETag() {
        if (!isset($this->metadata[OSSHeaders::ETAG])) {
            return null;
        }
        return $this->metadata[OSSHeaders::ETAG];
    }
1368617
@SuppressWarnings("unchecked")
    private void storeETag(HttpHost host, String file, HttpResponse response)
            throws IOException {
        //get ETag header
        Header etagHdr = response.getFirstHeader("ETag");
        if (etagHdr == null) {
            if (!quiet) {
                project.getLogger().warn("Server response does not include an "
                        + "entity tag (ETag).");
            }
            return;
        }
        String etag = etagHdr.getValue();

        //handle weak ETags
        if (isWeakETag(etag)) {
            if (useETag.displayWarningForWeak && !quiet) {
                project.getLogger().warn("Weak entity tag (ETag) encountered. "
                        + "Please make sure you want to compare resources based on "
                        + "weak ETags. If yes, set the 'useETag' flag to \"all\", "
                        + "otherwise set it to \"strongOnly\".");
            }
            if (!useETag.useWeakETags) {
                //do not save weak etags
                return;
            }
        }

        //create directory for cached etags file
        File parent = getCachedETagsFile().getParentFile();
        if (parent != null) {
            parent.mkdirs();
        }

        //read existing cached etags file
        Map<String, Object> cachedETags = readCachedETags();

        //create new entry in cached ETags file
        Map<String, String> etagMap = new LinkedHashMap<String, String>();
        etagMap.put("ETag", etag);

        String uri = host.toURI();
        Map<String, Object> hostMap = (Map<String, Object>)cachedETags.get(uri);
        if (hostMap == null) {
            hostMap = new LinkedHashMap<String, Object>();
            cachedETags.put(uri, hostMap);
        }
        hostMap.put(file, etagMap);

        //write cached ETags file
        String cachedETagsContents = JsonOutput.toJson(cachedETags);
        PrintWriter writer = new PrintWriter(getCachedETagsFile(), "UTF-8");
        try {
            writer.write(cachedETagsContents);
            writer.flush();
        } finally {
            writer.close();
        }
    }
382504
func (s *GetStreamingDistributionConfigOutput) SetETag(v string) *GetStreamingDistributionConfigOutput {
	s.ETag = &v
	return s
}
672835
public static function eTagChanged($file, $etag = null) {

        $etag = trim($etag, '" ');

        if (!$etag) {
            return true;
        }

        if (!file_exists($file)) {
            throw new Exception("File '$file' not exists");
        }

        if (!is_file($file)) {
            throw new Exception("'$file' is not file");
        }

        if (!is_readable($file)) {
            throw new Exception("File '$file' not readable");
        }

        return hash_file('crc32', $file) !== $etag;
    }
291878
func (s *DescribeObjectOutput) SetETag(v string) *DescribeObjectOutput {
	s.ETag = &v
	return s
}
392048
def _UpdateEtag(self, response):
    
    etag = response.headers.get('etag', self.etag)
    etag_updated = self.etag != etag
    self.etag = etag
    return etag_updated
569047
public function setGUID($guid)
    {
        $guidAttribute = $this->guidAttribute;
        if (preg_match(Number::GUID_REGEX, $guid)) {
            $guid = hex2bin(str_replace(['{', '}', '-'], '', $guid));
        }
        return (is_string($guidAttribute) && !empty($guidAttribute)) ? $this->$guidAttribute = $guid : null;
    }