public final class AccessCondition extends Object
| Constructor and Description |
|---|
AccessCondition()
Creates an instance of the
AccessCondition class. |
| Modifier and Type | Method and Description |
|---|---|
static void |
addOptionalHeader(HttpURLConnection request,
String name,
String value)
Adds the optional header.
|
void |
applyConditionToRequest(HttpURLConnection request)
RESERVED FOR INTERNAL USE.
|
void |
applyConditionToRequest(HttpURLConnection request,
boolean useSourceAccessHeaders)
RESERVED FOR INTERNAL USE.
|
static AccessCondition |
generateEmptyCondition()
Generates a new empty AccessCondition.
|
static AccessCondition |
generateIfMatchCondition(String etag)
Returns an access condition such that an operation will be performed only
if the resource's ETag value matches the specified ETag value.
|
static AccessCondition |
generateIfModifiedSinceCondition(Date lastMotified)
Returns an access condition such that an operation will be performed only
if the resource has been modified since the specified time.
|
static AccessCondition |
generateIfNoneMatchCondition(String etag)
Returns an access condition such that an operation will be performed only
if the resource's ETag value does not match the specified ETag value.
|
static AccessCondition |
generateIfNotModifiedSinceCondition(Date lastMotified)
Returns an access condition such that an operation will be performed only
if the resource has not been modified since the specified time.
|
static AccessCondition |
generateLeaseCondition(String leaseID)
Returns an access condition such that an operation will be performed only
if the resource is accessible under the specified lease id.
|
String |
getIfMatch() |
Date |
getIfModifiedSinceDate() |
String |
getIfNoneMatch() |
Date |
getIfUnmodifiedSinceDate() |
String |
getLeaseID() |
void |
setIfMatch(String etag) |
void |
setIfModifiedSinceDate(Date ifModifiedSinceDate) |
void |
setIfNoneMatch(String etag) |
void |
setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate) |
void |
setLeaseID(String leaseID) |
boolean |
verifyConditional(String etag,
Date lastModified)
Reserved for internal use.
|
public AccessCondition()
AccessCondition class.public static AccessCondition generateEmptyCondition()
For more information, see Specifying Conditional Headers for Blob Service Operations.
AccessCondition object that has no conditions
set.public static AccessCondition generateIfMatchCondition(String etag)
Setting this access condition modifies the request to include the HTTP If-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.
For more information, see Specifying Conditional Headers for Blob Service Operations.
etag - A String that represents the ETag value to check.AccessCondition object that represents the
If-Match condition.public static AccessCondition generateIfModifiedSinceCondition(Date lastMotified)
Setting this access condition modifies the request to include the HTTP If-Modified-Since conditional header. If this access condition is set, the operation is performed only if the resource has been modified since the specified time.
For more information, see Specifying Conditional Headers for Blob Service Operations.
lastMotified - A java.util.Date object that represents the
last-modified time to check for the resource.AccessCondition object that represents the
If-Modified-Since condition.public static AccessCondition generateIfNoneMatchCondition(String etag)
Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource does not match the specified ETag.
For more information, see Specifying Conditional Headers for Blob Service Operations.
etag - A String that represents the ETag value to check.AccessCondition object that represents the
If-None-Match condition.public static AccessCondition generateIfNotModifiedSinceCondition(Date lastMotified)
Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time.
For more information, see Specifying Conditional Headers for Blob Service Operations.
lastMotified - A java.util.Date object that represents the
last-modified time to check for the resource.AccessCondition object that represents the
If-Unmodified-Since condition.public static AccessCondition generateLeaseCondition(String leaseID)
Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time.
For more information, see Specifying Conditional Headers for Blob Service Operations.
leaseID - The lease id to specify.public void applyConditionToRequest(HttpURLConnection request)
request - A java.net.HttpURLConnection object that
represents the request to which the condition is being
applied.StorageException - If there is an error parsing the date value of the access
condition.public void applyConditionToRequest(HttpURLConnection request, boolean useSourceAccessHeaders)
request - A java.net.HttpURLConnection object that
represents the request to which the condition is being
applied.useSourceAccessHeaders - If true will use the Source_ headers for the conditions,
otherwise standard headers are used.StorageException - If there is an error parsing the date value of the access
condition.public String getIfMatch()
public Date getIfModifiedSinceDate()
public String getIfNoneMatch()
public Date getIfUnmodifiedSinceDate()
public String getLeaseID()
public void setIfMatch(String etag)
etag - the etag to setpublic void setIfModifiedSinceDate(Date ifModifiedSinceDate)
ifModifiedSinceDate - the ifModifiedSinceDate to setpublic void setIfNoneMatch(String etag)
etag - the etag to setpublic void setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate)
ifUnmodifiedSinceDate - the ifUnmodifiedSinceDate to setpublic void setLeaseID(String leaseID)
leaseID - the leaseID to setpublic boolean verifyConditional(String etag, Date lastModified)
etag - A String that represents the ETag to check.lastModified - A java.util.Date object that represents the last
modified date/time.true if the condition is satisfied; otherwise,
false.public static void addOptionalHeader(HttpURLConnection request, String name, String value)
request - a HttpURLConnection for the operation.name - the metadata name.value - the metadata value./**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/