当前位置: 首页>>代码示例>>Java>>正文


Java BaseRequest类代码示例

本文整理汇总了Java中com.microsoft.azure.storage.core.BaseRequest的典型用法代码示例。如果您正苦于以下问题:Java BaseRequest类的具体用法?Java BaseRequest怎么用?Java BaseRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseRequest类属于com.microsoft.azure.storage.core包,在下文中一共展示了BaseRequest类的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.applyConditionToRequest(request, true);
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:49,代码来源:BlobRequest.java

示例2: getAcl

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a web request to return the ACL for this container. Sign with no length specified.
 * 
 * @param uri
 *            The absolute URI to the container.
 * @param timeout
 *            The server timeout interval.
 * @param accessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the container.
 * @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 getAcl(final URI uri, final BlobRequestOptions blobOptions,
        final AccessCondition accessCondition, final OperationContext opContext) throws IOException,
        URISyntaxException, StorageException {
    final UriQueryBuilder builder = getContainerUriQueryBuilder();
    builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL);

    final HttpURLConnection request = createURLConnection(uri, builder, blobOptions, opContext);

    request.setRequestMethod(Constants.HTTP_GET);

    if (accessCondition != null && !Utility.isNullOrEmpty(accessCondition.getLeaseID())) {
        BaseRequest.addLeaseId(request, accessCondition.getLeaseID());
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:33,代码来源:BlobRequest.java

示例3: setAcl

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Sets the ACL for the container. Sign with length of aclBytes.
 * 
 * @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 container.
 * @param publicAccess
 *            The type of public access to allow for the container.
 * @return a HttpURLConnection configured for the operation.
 * @throws StorageException
 * */
public static HttpURLConnection setAcl(final URI uri, final BlobRequestOptions blobOptions,
        final OperationContext opContext, final AccessCondition accessCondition,
        final BlobContainerPublicAccessType publicAccess) throws IOException, URISyntaxException, StorageException {
    final UriQueryBuilder builder = getContainerUriQueryBuilder();
    builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL);

    final HttpURLConnection request = createURLConnection(uri, builder, blobOptions, opContext);

    request.setRequestMethod(Constants.HTTP_PUT);
    request.setDoOutput(true);

    if (publicAccess != BlobContainerPublicAccessType.OFF) {
        request.setRequestProperty(BlobConstants.BLOB_PUBLIC_ACCESS_HEADER, publicAccess.toString().toLowerCase());
    }

    if (accessCondition != null && !Utility.isNullOrEmpty(accessCondition.getLeaseID())) {
        BaseRequest.addLeaseId(request, accessCondition.getLeaseID());
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:42,代码来源:BlobRequest.java

示例4: listFilesAndDirectories

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a request to return a listing of all files and directories 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.
 * @return a HttpURLConnection configured for the operation.
 * @throws IOException
 * @throws URISyntaxException
 * @throws StorageException
 * @throws IllegalArgumentException
 */
public static HttpURLConnection listFilesAndDirectories(final URI uri, final FileRequestOptions fileOptions,
        final OperationContext opContext, final ListingContext listingContext) throws URISyntaxException,
        IOException, StorageException {

    final UriQueryBuilder builder = getDirectoryUriQueryBuilder();
    builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.LIST);

    if (listingContext != null) {
        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());
        }
    }

    final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);

    request.setRequestMethod(Constants.HTTP_GET);

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:46,代码来源:FileRequest.java

示例5: 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;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:49,代码来源:BlobRequest.java

示例6: 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 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
 *            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 <code>HttpURLConnection</code> 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 FileRequestOptions fileOptions,
        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, fileOptions, 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.applyConditionToRequest(request);
    }

    return request;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:49,代码来源:FileRequest.java

示例7: deleteShare

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a web request to delete the share and all of the directories and files within it. 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 share.
 * @return a HttpURLConnection configured for the operation.
 * @throws StorageException
 * @throws IllegalArgumentException
 */
public static HttpURLConnection deleteShare(final URI uri, final FileRequestOptions fileOptions,
        final OperationContext opContext, final AccessCondition accessCondition, String snapshotVersion, DeleteShareSnapshotsOption deleteSnapshotsOption) 
                throws IOException, URISyntaxException, StorageException {
    final UriQueryBuilder shareBuilder = getShareUriQueryBuilder();
    FileRequest.addShareSnapshot(shareBuilder, snapshotVersion);
    HttpURLConnection request = BaseRequest.delete(uri, fileOptions, shareBuilder, opContext);
    if (accessCondition != null) {
        accessCondition.applyConditionToRequest(request);
    }

    switch (deleteSnapshotsOption) {
    case NONE:
        // nop
        break;
    case INCLUDE_SNAPSHOTS:
        request.setRequestProperty(Constants.HeaderConstants.DELETE_SNAPSHOT_HEADER,
                Constants.HeaderConstants.INCLUDE_SNAPSHOTS_VALUE);
        break;
    default:
        break;
    }

    return request;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:45,代码来源:FileRequest.java

示例8: addProperties

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Adds the properties.
 * 
 * @param request
 *            The request.
 * @param properties
 *            The properties object.
 */
private static void addProperties(final HttpURLConnection request, BlobProperties properties) {
    BaseRequest.addOptionalHeader(request, Constants.HeaderConstants.CACHE_CONTROL_HEADER,
            properties.getCacheControl());
    BaseRequest.addOptionalHeader(request, BlobConstants.CONTENT_DISPOSITION_HEADER,
            properties.getContentDisposition());
    BaseRequest.addOptionalHeader(request, BlobConstants.CONTENT_ENCODING_HEADER, properties.getContentEncoding());
    BaseRequest.addOptionalHeader(request, BlobConstants.CONTENT_LANGUAGE_HEADER, properties.getContentLanguage());
    BaseRequest.addOptionalHeader(request, BlobConstants.BLOB_CONTENT_MD5_HEADER, properties.getContentMD5());
    BaseRequest.addOptionalHeader(request, BlobConstants.CONTENT_TYPE_HEADER, properties.getContentType());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:19,代码来源:BlobRequest.java

示例9: 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;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:57,代码来源:BlobRequest.java

示例10: deleteBlob

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a HttpURLConnection to delete the blob, 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 deleteSnapshotsOption
 *            A set of options indicating whether to delete only blobs, only snapshots, 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 deleteBlob(final URI uri, final BlobRequestOptions blobOptions,
        final OperationContext opContext, final AccessCondition accessCondition, final String snapshotVersion,
        final DeleteSnapshotsOption deleteSnapshotsOption) throws IOException, URISyntaxException, StorageException {

    if (snapshotVersion != null && deleteSnapshotsOption != DeleteSnapshotsOption.NONE) {
        throw new IllegalArgumentException(String.format(SR.DELETE_SNAPSHOT_NOT_VALID_ERROR,
                "deleteSnapshotsOption", "snapshot"));
    }

    final UriQueryBuilder builder = new UriQueryBuilder();
    BlobRequest.addSnapshot(builder, snapshotVersion);
    final HttpURLConnection request = BaseRequest.delete(uri, blobOptions, builder, opContext);

    if (accessCondition != null) {
        accessCondition.applyConditionToRequest(request);
    }

    switch (deleteSnapshotsOption) {
        case NONE:
            // nop
            break;
        case INCLUDE_SNAPSHOTS:
            request.setRequestProperty(Constants.HeaderConstants.DELETE_SNAPSHOT_HEADER,
                    BlobConstants.INCLUDE_SNAPSHOTS_VALUE);
            break;
        case DELETE_SNAPSHOTS_ONLY:
            request.setRequestProperty(Constants.HeaderConstants.DELETE_SNAPSHOT_HEADER,
                    BlobConstants.SNAPSHOTS_ONLY_VALUE);
            break;
        default:
            break;
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:64,代码来源:BlobRequest.java

示例11: getBlob

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a HttpURLConnection to download the blob, 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 offset
 *            The offset at which to begin returning content.
 * @param count
 *            The number of bytes to return.
 * @param requestRangeContentMD5
 *            If set to true, request an MD5 header for the specified range.
 * @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 getBlob(final URI uri, final BlobRequestOptions blobOptions,
        final OperationContext opContext, final AccessCondition accessCondition, final String snapshotVersion,
        final Long offset, final Long count, boolean requestRangeContentMD5) throws IOException,
        URISyntaxException, StorageException {

    if (offset != null && requestRangeContentMD5) {
        Utility.assertNotNull("count", count);
        Utility.assertInBounds("count", count, 1, Constants.MAX_BLOCK_SIZE);
    }

    final UriQueryBuilder builder = new UriQueryBuilder();
    BlobRequest.addSnapshot(builder, snapshotVersion);
    final HttpURLConnection request = BaseRequest.createURLConnection(uri, blobOptions, builder, opContext);
    request.setRequestMethod(Constants.HTTP_GET);

    if (accessCondition != null) {
        accessCondition.applyConditionToRequest(request);
    }

    if (offset != null) {
        long rangeStart = offset;
        long rangeEnd;
        if (count != null) {
            rangeEnd = offset + count - 1;
            request.setRequestProperty(Constants.HeaderConstants.STORAGE_RANGE_HEADER, String.format(
                    Utility.LOCALE_US, Constants.HeaderConstants.RANGE_HEADER_FORMAT, rangeStart, rangeEnd));
        }
        else {
            request.setRequestProperty(Constants.HeaderConstants.STORAGE_RANGE_HEADER, String.format(
                    Utility.LOCALE_US, Constants.HeaderConstants.BEGIN_RANGE_HEADER_FORMAT, rangeStart));
        }
    }

    if (offset != null && requestRangeContentMD5) {
        request.setRequestProperty(Constants.HeaderConstants.RANGE_GET_CONTENT_MD5, Constants.TRUE);
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:72,代码来源:BlobRequest.java

示例12: addProperties

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Adds the properties.
 * 
 * @param request
 *            The request.
 * @param properties
 *            The properties.
 */
private static void addProperties(final HttpURLConnection request, FileProperties properties) {
    BaseRequest.addOptionalHeader(request, FileConstants.CACHE_CONTROL_HEADER, properties.getCacheControl());
    BaseRequest.addOptionalHeader(request, FileConstants.CONTENT_DISPOSITION_HEADER,
            properties.getContentDisposition());
    BaseRequest.addOptionalHeader(request, FileConstants.CONTENT_ENCODING_HEADER, properties.getContentEncoding());
    BaseRequest.addOptionalHeader(request, FileConstants.CONTENT_LANGUAGE_HEADER, properties.getContentLanguage());
    BaseRequest.addOptionalHeader(request, FileConstants.FILE_CONTENT_MD5_HEADER, properties.getContentMD5());
    BaseRequest.addOptionalHeader(request, FileConstants.CONTENT_TYPE_HEADER, properties.getContentType());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:18,代码来源:FileRequest.java

示例13: getFile

import com.microsoft.azure.storage.core.BaseRequest; //导入依赖的package包/类
/**
 * Constructs a HttpURLConnection to download the file, 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.
 * @param offset
 *            The offset at which to begin returning content.
 * @param count
 *            The number of bytes to return.
 * @param requestRangeContentMD5
 *            If set to true, request an MD5 header for the specified range.
 * @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 getFile(final URI uri, final FileRequestOptions fileOptions,
        final OperationContext opContext, final AccessCondition accessCondition, final Long offset,
        final Long count, boolean requestRangeContentMD5) throws IOException, URISyntaxException, StorageException {

    if (offset != null && requestRangeContentMD5) {
        Utility.assertNotNull("count", count);
        Utility.assertInBounds("count", count, 1, Constants.MAX_BLOCK_SIZE);
    }

    final UriQueryBuilder builder = new UriQueryBuilder();
    final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
    request.setRequestMethod(Constants.HTTP_GET);

    if (accessCondition != null) {
        accessCondition.applyConditionToRequest(request);
    }

    if (offset != null) {
        long rangeStart = offset;
        long rangeEnd;
        if (count != null) {
            rangeEnd = offset + count - 1;
            request.setRequestProperty(Constants.HeaderConstants.STORAGE_RANGE_HEADER, String.format(
                    Utility.LOCALE_US, Constants.HeaderConstants.RANGE_HEADER_FORMAT, rangeStart, rangeEnd));
        }
        else {
            request.setRequestProperty(Constants.HeaderConstants.STORAGE_RANGE_HEADER, String.format(
                    Utility.LOCALE_US, Constants.HeaderConstants.BEGIN_RANGE_HEADER_FORMAT, rangeStart));
        }
    }

    if (offset != null && requestRangeContentMD5) {
        request.setRequestProperty(Constants.HeaderConstants.RANGE_GET_CONTENT_MD5, Constants.TRUE);
    }

    return request;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:68,代码来源:FileRequest.java

示例14: 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;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:56,代码来源:FileRequest.java

示例15: 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;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:64,代码来源:TableRequest.java


注:本文中的com.microsoft.azure.storage.core.BaseRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。