本文整理汇总了Java中com.microsoft.azure.storage.core.BaseRequest.createURLConnection方法的典型用法代码示例。如果您正苦于以下问题:Java BaseRequest.createURLConnection方法的具体用法?Java BaseRequest.createURLConnection怎么用?Java BaseRequest.createURLConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.core.BaseRequest
的用法示例。
在下文中一共展示了BaseRequest.createURLConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: abortCopy
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Generates a web request to abort a copy operation.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param blobOptions
* A {@link BlobRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudBlobClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param accessCondition
* The access condition to apply to the request. Only lease conditions are supported for this operation.
* @param copyId
* A <code>String</code> object that identifying the copy operation.
* @return a HttpURLConnection configured for the operation.
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
* @throws IOException
* @throws URISyntaxException
*/
public static HttpURLConnection abortCopy(final URI uri, final BlobRequestOptions blobOptions,
final OperationContext opContext, final AccessCondition accessCondition, final String copyId)
throws StorageException, IOException, URISyntaxException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.COPY);
builder.add(Constants.QueryConstants.COPY_ID, copyId);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, blobOptions, builder, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
request.setRequestProperty(Constants.HeaderConstants.COPY_ACTION_HEADER,
Constants.HeaderConstants.COPY_ACTION_ABORT);
if (accessCondition != null) {
accessCondition.applyLeaseConditionToRequest(request);
}
return request;
}
示例2: coreCreate
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Reserved for internal use. Constructs the core <code>HttpURLConnection</code> to perform an operation.
*
* @param rootUri
* A <code>java.net.URI</code> containing an absolute URI to the resource.
* @param queryBuilder
* The <code>UriQueryBuilder</code> for the request.
* @param opContext
* An {@link OperationContext} object for tracking the current operation.
* @param tableName
* The name of the table.
* @param identity
* The identity of the entity, to pass in the Service Managment REST operation URI as
* <code><em>tableName</em>(<em>identity</em>)</code>. If <code>null</code>, only the <em>tableName</em>
* value will be passed.
* @param requestMethod
* The HTTP request method to set.
* @param options
* A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. This parameter is unused.
* @return
* An <code>HttpURLConnection</code> to use to perform the operation.
*
* @throws IOException
* if there is an error opening the connection.
* @throws URISyntaxException
* if the resource URI is invalid.
* @throws StorageException
* if a storage service error occurred during the operation.
*/
private static HttpURLConnection coreCreate(final URI rootUri, final TableRequestOptions tableOptions,
final UriQueryBuilder queryBuilder, final OperationContext opContext, final String tableName,
final String eTag, final String identity, final String requestMethod) throws IOException,
URISyntaxException, StorageException {
URI queryUri = null;
// Do point query / delete etc.
if (!Utility.isNullOrEmpty(identity)) {
queryUri = PathUtility.appendPathToSingleUri(rootUri, tableName.concat(String.format("(%s)", identity)));
}
else {
queryUri = PathUtility.appendPathToSingleUri(rootUri, tableName);
}
final HttpURLConnection retConnection = BaseRequest.createURLConnection(queryUri, tableOptions, queryBuilder,
opContext);
setAcceptHeaderForHttpWebRequest(retConnection, tableOptions.getTablePayloadFormat());
retConnection.setRequestProperty(Constants.HeaderConstants.CONTENT_TYPE,
TableConstants.HeaderConstants.JSON_CONTENT_TYPE);
retConnection.setRequestProperty(TableConstants.HeaderConstants.MAX_DATA_SERVICE_VERSION,
TableConstants.HeaderConstants.MAX_DATA_SERVICE_VERSION_VALUE);
if (!Utility.isNullOrEmpty(eTag)) {
retConnection.setRequestProperty(Constants.HeaderConstants.IF_MATCH, eTag);
}
retConnection.setRequestMethod(requestMethod);
return retConnection;
}
示例3: copyFrom
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Creates a request to copy a blob, Sign with 0 length.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param blobOptions
* A {@link BlobRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudBlobClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param source
* The canonical path to the source blob, in the form /<account-name>/<container-name>/<blob-name>.
* @param sourceSnapshotID
* The snapshot version, if the source blob is a snapshot.
* @param sourceAccessConditionType
* A type of condition to check on the source blob.
* @param sourceAccessConditionValue
* The value of the condition to check on the source blob
* @return a HttpURLConnection configured for the operation.
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
* @throws IOException
* @throws URISyntaxException
*/
public static HttpURLConnection copyFrom(final URI uri, final BlobRequestOptions blobOptions,
final OperationContext opContext, final AccessCondition sourceAccessCondition,
final AccessCondition destinationAccessCondition, String source, final String sourceSnapshotID)
throws StorageException, IOException, URISyntaxException {
if (sourceSnapshotID != null) {
source = source.concat("?snapshot=");
source = source.concat(sourceSnapshotID);
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, blobOptions, null, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
request.setRequestProperty(Constants.HeaderConstants.COPY_SOURCE_HEADER, source);
if (sourceAccessCondition != null) {
sourceAccessCondition.applyConditionToRequest(request, true);
}
if (destinationAccessCondition != null) {
destinationAccessCondition.applyConditionToRequest(request);
}
return request;
}
示例4: listShares
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a request to return a listing of all shares in this storage account. Sign with no length
* specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param fileOptions
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param listingContext
* A set of parameters for the listing operation.
* @param detailsIncluded
* A <code>java.util.EnumSet</code> object that contains {@link ShareListingDetails} values that indicate
* whether share snapshots and/or metadata will be returned.
* @return a HttpURLConnection configured for the operation.
* @throws IOException
* @throws URISyntaxException
* @throws StorageException
* @throws IllegalArgumentException
*/
public static HttpURLConnection listShares(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final ListingContext listingContext,
final EnumSet<ShareListingDetails> detailsIncluded) throws URISyntaxException, IOException, StorageException {
final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext);
if (detailsIncluded != null && detailsIncluded.size() > 0) {
final StringBuilder sb = new StringBuilder();
boolean started = false;
if (detailsIncluded.contains(ShareListingDetails.SNAPSHOTS)) {
started = true;
sb.append(SNAPSHOTS_QUERY_ELEMENT_NAME);
}
if (detailsIncluded.contains(ShareListingDetails.METADATA)) {
if (started)
{
sb.append(",");
}
sb.append(Constants.QueryConstants.METADATA);
}
builder.add(Constants.QueryConstants.INCLUDE, sb.toString());
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
return request;
}
示例5: listShares
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a request to return a listing of all shares in this storage account. Sign with no length
* specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param fileOptions
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param listingContext
* A set of parameters for the listing operation.
* @param detailsIncluded
* Additional details to return with the listing.
* @return a HttpURLConnection configured for the operation.
* @throws IOException
* @throws URISyntaxException
* @throws StorageException
* @throws IllegalArgumentException
*/
public static HttpURLConnection listShares(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final ListingContext listingContext,
final ShareListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException {
final UriQueryBuilder builder = getShareUriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.LIST);
if (listingContext != null) {
if (!Utility.isNullOrEmpty(listingContext.getPrefix())) {
builder.add(Constants.QueryConstants.PREFIX, listingContext.getPrefix());
}
if (!Utility.isNullOrEmpty(listingContext.getMarker())) {
builder.add(Constants.QueryConstants.MARKER, listingContext.getMarker());
}
if (listingContext.getMaxResults() != null && listingContext.getMaxResults() > 0) {
builder.add(Constants.QueryConstants.MAX_RESULTS, listingContext.getMaxResults().toString());
}
}
if (detailsIncluded == ShareListingDetails.ALL || detailsIncluded == ShareListingDetails.METADATA) {
builder.add(Constants.QueryConstants.INCLUDE, Constants.QueryConstants.METADATA);
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
return request;
}
示例6: list
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a web request to return a listing of all queues in this
* storage account. Sign the web request with a length of -1L.
*
* @param uri
* A <code>URI</code> object that specifies the absolute URI to
* the storage account.
* @param queueOptions
* A {@link QueueRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudQueueClient}.
* @param opContext
* An {@link OperationContext} object that represents the context
* for the current operation. This object is used to track
* requests to the storage service, and to provide additional
* runtime information about the operation.
* @param listingContext
* A {@link ListingContext} object that specifies parameters for
* the listing operation, if any. May be <code>null</code>.
* @param detailsIncluded
* A {@link QueueListingDetails} object that specifies additional
* details to return with the listing, if any. May be <code>null</code>.
* @return An <code>HttpURLConnection</code> configured for the specified
* operation.
*
* @throws IOException
* @throws URISyntaxException
* If the URI is not valid.
* @throws StorageException
* If a storage service error occurred during the operation.
*/
public static HttpURLConnection list(final URI uri, final QueueRequestOptions queueOptions,
final OperationContext opContext, final ListingContext listingContext,
final QueueListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.LIST);
if (listingContext != null) {
if (!Utility.isNullOrEmpty(listingContext.getPrefix())) {
builder.add(Constants.QueryConstants.PREFIX, listingContext.getPrefix());
}
if (!Utility.isNullOrEmpty(listingContext.getMarker())) {
builder.add(Constants.QueryConstants.MARKER, listingContext.getMarker());
}
if (listingContext.getMaxResults() != null && listingContext.getMaxResults() > 0) {
builder.add(Constants.QueryConstants.MAX_RESULTS, listingContext.getMaxResults().toString());
}
}
if (detailsIncluded == QueueListingDetails.ALL || detailsIncluded == QueueListingDetails.METADATA) {
builder.add(Constants.QueryConstants.INCLUDE, Constants.QueryConstants.METADATA);
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
return request;
}
示例7: batch
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Reserved for internal use. Constructs an <code>HttpURLConnection</code> to perform a table batch operation.
*
* @param rootUri
* A <code>java.net.URI</code> containing an absolute URI to the resource.
* @param tableOptions
* A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. This parameter is unused.
* @param queryBuilder
* The {@link UriQueryBuilder} for the operation.
* @param opContext
* An {@link OperationContext} object for tracking the current operation. Specify <code>null</code> to
* safely ignore operation context.
* @param batchID
* The <code>String</code> containing the batch identifier.
* @return
* An <code>HttpURLConnection</code> to use to perform the operation.
*
* @throws IOException
* if there is an error opening the connection.
* @throws URISyntaxException
* if the resource URI is invalid.
* @throws StorageException
* if a storage service error occurred during the operation.
*/
public static HttpURLConnection batch(final URI rootUri, final TableRequestOptions tableOptions,
final UriQueryBuilder queryBuilder, final OperationContext opContext, final String batchID)
throws IOException, URISyntaxException, StorageException {
final URI queryUri = PathUtility.appendPathToSingleUri(rootUri, "$batch");
final HttpURLConnection retConnection = BaseRequest.createURLConnection(queryUri, tableOptions, queryBuilder,
opContext);
setAcceptHeaderForHttpWebRequest(retConnection, tableOptions.getTablePayloadFormat());
retConnection.setRequestProperty(Constants.HeaderConstants.CONTENT_TYPE,
String.format(TableConstants.HeaderConstants.MULTIPART_MIXED_FORMAT, batchID));
retConnection.setRequestProperty(TableConstants.HeaderConstants.MAX_DATA_SERVICE_VERSION,
TableConstants.HeaderConstants.MAX_DATA_SERVICE_VERSION_VALUE);
retConnection.setRequestMethod("POST");
retConnection.setDoOutput(true);
return retConnection;
}
示例8: getBlockList
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a HttpURLConnection to return a list of the block blobs blocks. Sign with no length specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param blobOptions
* A {@link BlobRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudBlobClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param accessCondition
* An {@link AccessCondition} object that represents the access conditions for the blob.
* @param snapshotVersion
* The snapshot version, if the blob is a snapshot.
* @param blockFilter
* The types of blocks to include in the list: committed, uncommitted, or both.
* @return a HttpURLConnection to use to perform the operation.
* @throws IOException
* if there is an error opening the connection
* @throws URISyntaxException
* if the resource URI is invalid
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
*/
public static HttpURLConnection getBlockList(final URI uri, final BlobRequestOptions blobOptions,
final OperationContext opContext, final AccessCondition accessCondition, final String snapshotVersion,
final BlockListingFilter blockFilter) throws StorageException, IOException, URISyntaxException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, BLOCK_LIST_QUERY_ELEMENT_NAME);
builder.add(BLOCK_LIST_TYPE_QUERY_ELEMENT_NAME, blockFilter.toString());
BlobRequest.addSnapshot(builder, snapshotVersion);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, blobOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
return request;
}
示例9: getFileRanges
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a HttpURLConnection to return a list of the file's file ranges. Sign with no length specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param fileOptions
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param accessCondition
* An {@link AccessCondition} object that represents the access conditions for the file.
* @return a HttpURLConnection to use to perform the operation.
* @throws IOException
* if there is an error opening the connection
* @throws URISyntaxException
* if the resource URI is invalid
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
*/
public static HttpURLConnection getFileRanges(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition) throws StorageException,
IOException, URISyntaxException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, RANGE_LIST_QUERY_ELEMENT_NAME);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
return request;
}
示例10: putMessage
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a web request to add a message to the back of the queue. Write the encoded message request body
* generated with a call to QueueMessageSerializer#generateMessageRequestBody(String)} to the output
* stream of the request. Sign the web request with the length of the encoded message request body.
*
* @param uri
* A <code>URI</code> object that specifies the absolute URI to
* the queue.
* @param queueOptions
* A {@link QueueRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudQueueClient}.
* @param opContext
* An {@link OperationContext} object that represents the context
* for the current operation. This object is used to track
* requests to the storage service, and to provide additional
* runtime information about the operation.
* @param visibilityTimeoutInSeconds
* Specifies the length of time for the message to be invisible
* in seconds, starting when it is added to the queue. A value of
* 0 will make the message visible immediately. The value must be
* greater than or equal to 0, and cannot be larger than 7 days.
* The visibility timeout of a message cannot be set to a value
* greater than the time-to-live time.
* @param timeToLiveInSeconds
* Specifies the time-to-live interval for the message, in
* seconds. The maximum time-to-live allowed is 7 days. If this
* parameter is 0, the default time-to-live of 7 days is used.
* @return An <code>HttpURLConnection</code> configured for the specified
* operation.
*
* @throws IOException
* @throws URISyntaxException
* If the URI is not valid.
* @throws StorageException
* If a storage service error occurred during the operation.
*/
public static HttpURLConnection putMessage(final URI uri, final QueueRequestOptions queueOptions,
final OperationContext opContext, final int visibilityTimeoutInSeconds, final int timeToLiveInSeconds)
throws IOException, URISyntaxException, StorageException {
final UriQueryBuilder builder = new UriQueryBuilder();
if (visibilityTimeoutInSeconds != 0) {
builder.add(VISIBILITY_TIMEOUT, Integer.toString(visibilityTimeoutInSeconds));
}
if (timeToLiveInSeconds != 0) {
builder.add(MESSAGE_TTL, Integer.toString(timeToLiveInSeconds));
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_POST);
return request;
}
示例11: list
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a web request to return a listing of all queues in this
* storage account. Sign the web request with a length of -1L.
*
* @param uri
* A <code>URI</code> object that specifies the absolute URI to
* the storage account.
* @param queueOptions
* A {@link QueueRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudQueueClient}.
* @param opContext
* An {@link OperationContext} object that represents the context
* for the current operation. This object is used to track
* requests to the storage service, and to provide additional
* runtime information about the operation.
* @param listingContext
* A {@link ListingContext} object that specifies parameters for
* the listing operation, if any. May be <code>null</code>.
* @param detailsIncluded
* A {@link QueueListingDetails} object that specifies additional
* details to return with the listing, if any. May be <code>null</code>.
* @return An <code>HttpURLConnection</code> configured for the specified
* operation.
*
* @throws IOException
* @throws URISyntaxException
* If the URI is not valid.
* @throws StorageException
* If a storage service error occurred during the operation.
*/
public static HttpURLConnection list(final URI uri, final QueueRequestOptions queueOptions,
final OperationContext opContext, final ListingContext listingContext,
final QueueListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException {
final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext);
if (detailsIncluded == QueueListingDetails.ALL || detailsIncluded == QueueListingDetails.METADATA) {
builder.add(Constants.QueryConstants.INCLUDE, Constants.QueryConstants.METADATA);
}
final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
request.setRequestMethod(Constants.HTTP_GET);
return request;
}
示例12: setFileProperties
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a HttpURLConnection to set the file's properties, Sign with zero length specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param fileOptions
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param accessCondition
* An {@link AccessCondition} object that represents the access conditions for the file.
* @param properties
* The properties to upload.
* @return a HttpURLConnection to use to perform the operation.
* @throws IOException
* if there is an error opening the connection
* @throws URISyntaxException
* if the resource URI is invalid
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
*/
public static HttpURLConnection setFileProperties(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition, final FileProperties properties)
throws IOException, URISyntaxException, StorageException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.PROPERTIES);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
if (properties != null) {
addProperties(request, properties);
}
return request;
}
示例13: copyFrom
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Creates a request to copy a file, Sign with 0 length.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param fileOptions
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param source
* The canonical path to the source file,
* in the form /<account-name>/<share-name>/<directory-path>/<file-name>.
* @param sourceAccessConditionType
* A type of condition to check on the source file.
* @param sourceAccessConditionValue
* The value of the condition to check on the source file
* @return a HttpURLConnection configured for the operation.
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
* @throws IOException
* @throws URISyntaxException
*/
public static HttpURLConnection copyFrom(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition sourceAccessCondition,
final AccessCondition destinationAccessCondition, String source)
throws StorageException, IOException, URISyntaxException {
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, null, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
request.setRequestProperty(Constants.HeaderConstants.COPY_SOURCE_HEADER, source);
if (sourceAccessCondition != null) {
sourceAccessCondition.applyConditionToRequest(request);
}
if (destinationAccessCondition != null) {
destinationAccessCondition.applyConditionToRequest(request);
}
return request;
}
示例14: setShareProperties
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Constructs a HttpURLConnection to set the share's properties, signed with zero length specified.
*
* @param uri
* A <code>java.net.URI</code> object that specifies the absolute URI.
* @param options
* A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudFileClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @param accessCondition
* An {@link AccessCondition} object that represents the access conditions for the file.
* @param properties
* The properties to upload.
* @return a HttpURLConnection to use to perform the operation.
* @throws IOException
* if there is an error opening the connection
* @throws URISyntaxException
* if the resource URI is invalid
* @throws StorageException
* an exception representing any error which occurred during the operation.
* @throws IllegalArgumentException
*/
public static HttpURLConnection setShareProperties(final URI uri, final FileRequestOptions options,
final OperationContext opContext, final AccessCondition accessCondition, final FileShareProperties properties)
throws IOException, URISyntaxException, StorageException {
final UriQueryBuilder builder = getShareUriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.PROPERTIES);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, options, builder, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
if (properties != null) {
addProperties(request, properties);
}
return request;
}
示例15: setAcl
import com.microsoft.azure.storage.core.BaseRequest; //导入方法依赖的package包/类
/**
* Sets the ACL for the queue. Sign with length of aclBytes.
*
* @param uri
* The absolute URI to the queue.
* @param queueOptions
* A {@link QueueRequestOptions} object that specifies execution options such as retry policy and timeout
* settings for the operation. Specify <code>null</code> to use the request options specified on the
* {@link CloudQueueClient}.
* @param opContext
* An {@link OperationContext} object that represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
* @return a HttpURLConnection configured for the operation.
* @throws StorageException
* */
public static HttpURLConnection setAcl(final URI uri, final QueueRequestOptions queueOptions,
final OperationContext opContext) throws IOException, URISyntaxException, StorageException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
return request;
}