public class ETagHandler extends Object
| Constructor and Description |
|---|
ETagHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected static Optional<ETag> |
getETagFromHeader(Map<String,String> httpHeaders,
boolean ifNot)
will extract either the If-Match header from the request or the If-None-Match header if one of these do
exist.
|
static Optional<ETag> |
getResourceVersion(ServiceProvider serviceProvider,
ResourceNode resourceNode)
if the service provider has its support vor eTag set to true this method will return either the already set
version from the meta-attribute of the resource node or will generate a version value by generating a
base64 encoded SHA-1 hash of the resource
|
static void |
validateVersion(ServiceProvider serviceProvider,
Supplier<ResourceNode> currentState,
Map<String,String> httpHeaders)
will validate if the given httpHeaders do contain an entity tag within the request and if this entity tag
matches the state of the current resource
|
public static Optional<ETag> getResourceVersion(ServiceProvider serviceProvider, ResourceNode resourceNode)
serviceProvider - the service provider configurationresourceNode - the current resource nodepublic static void validateVersion(ServiceProvider serviceProvider, Supplier<ResourceNode> currentState, Map<String,String> httpHeaders)
serviceProvider - the service provider configurationcurrentState - supplier that gives access to the resource that should be checkedhttpHeaders - the http headers that might contain the corresponding http request headersprotected static Optional<ETag> getETagFromHeader(Map<String,String> httpHeaders, boolean ifNot)
httpHeaders - the http headers from the request that optionally have one of the entity tag headersifNot - if set to true the If-None-Match header is extracted, the If-Match header if set to falseCopyright © 2019. All rights reserved.