@Override public void eventOccurred(SendingRequestEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg.getConnectionObject(); String userAgentInfo = String.format(Utility.LOCALE_US, "WASB/%s (%s) %s", VersionInfo.getVersion(), userAgentId, BaseRequest.getUserAgent()); connection.setRequestProperty(Constants.HeaderConstants.USER_AGENT, userAgentInfo); } });
/** * Adds the metadata. * * @param request * The request. * @param metadata * The metadata. */ public static void addMetadata(final HttpURLConnection request, final HashMap<String, String> metadata, final OperationContext opContext) { BaseRequest.addMetadata(request, metadata, opContext); }
/** * Adds the properties. * * @param request * The request * @param properties * The share properties */ private static void addProperties(final HttpURLConnection request, FileShareProperties properties) { final Integer shareQuota = properties.getShareQuota(); BaseRequest.addOptionalHeader( request, FileConstants.SHARE_QUOTA_HEADER, shareQuota == null ? null : shareQuota.toString()); }
final OperationContext opContext, final ListingContext listingContext, final QueueListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException { final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext); final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
/** * Creates the web request. * * @param uri * The absolute URI to the container. * @param query * The query builder to use. * @param blobOptions * the options to use for the request. * @param opContext * a tracking object for the request * @return a HttpURLConnection configured for the operation. * @throws StorageException * an exception representing any error which occurred during the operation. * @throws IllegalArgumentException */ private static HttpURLConnection createURLConnection(final URI uri, final UriQueryBuilder query, final BlobRequestOptions blobOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { return BaseRequest.createURLConnection(uri, blobOptions, query, opContext); }
/** * Constructs a web request to delete the queue. Sign the web request with a * length of -1L. * * @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. * * @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 delete(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { return BaseRequest.delete(uri, queueOptions, null, opContext); }
/** * Constructs a web request to create a new queue. Sign the web request with * a length of 0. * * @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. * * @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 create(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { return BaseRequest.create(uri, queueOptions, null, opContext); }
/** * Constructs a web request to return the user-defined metadata for this container. 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 container. * @return a HttpURLConnection configured for the operation. * @throws StorageException * */ private static HttpURLConnection getProperties(final URI uri, final BlobRequestOptions blobOptions, final OperationContext opContext, AccessCondition accessCondition, final UriQueryBuilder builder) throws IOException, URISyntaxException, StorageException { HttpURLConnection request = BaseRequest.getProperties(uri, blobOptions, builder, opContext); if (accessCondition != null) { accessCondition.applyLeaseConditionToRequest(request); } return request; }
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { return BaseRequest.getServiceProperties( credentials.transformUri(client.getEndpoint()), options, null, context); }
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { return BaseRequest.getServiceStats( credentials.transformUri(client.getStorageUri().getUri(this.getCurrentLocation())), options, null, context); }
final OperationContext opContext, final ListingContext listingContext, final ContainerListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException { final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext);
/** * Creates the web request. * * @param uri * The absolute URI to the container. * @param timeout * The server timeout interval. * @param query * The query builder to use. * @param blobOptions * the options to use for the request. * @param opContext * a tracking object for the request * @return a HttpURLConnection configured for the operation. * @throws StorageException * an exception representing any error which occurred during the operation. * @throws IllegalArgumentException */ private static HttpURLConnection createURLConnection(final URI uri, final UriQueryBuilder query, final BlobRequestOptions blobOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { return BaseRequest.createURLConnection(uri, blobOptions, query, opContext); }
final OperationContext opContext, final ListingContext listingContext, final QueueListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException { final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext); final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext);
/** * Constructs a web request to clear all the messages in the queue. Sign the * web request with a length of -1L. * * @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. * * @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 clearMessages(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws URISyntaxException, IOException, StorageException { return BaseRequest.delete(uri, queueOptions, null, opContext); }
/** * Constructs a web request to create a new queue. Sign the web request with * a length of 0. * * @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. * * @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 create(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { return BaseRequest.create(uri, queueOptions, null, opContext); }
/** * Constructs a web request to return the user-defined metadata for this container. 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 container. * @return a HttpURLConnection configured for the operation. * @throws StorageException * */ private static HttpURLConnection getProperties(final URI uri, final BlobRequestOptions blobOptions, final OperationContext opContext, AccessCondition accessCondition, final UriQueryBuilder builder) throws IOException, URISyntaxException, StorageException { HttpURLConnection request = BaseRequest.getProperties(uri, blobOptions, builder, opContext); if (accessCondition != null) { accessCondition.applyLeaseConditionToRequest(request); } return request; }
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { return BaseRequest.getServiceProperties( credentials.transformUri(client.getEndpoint()), options, null, context); }
@Override public HttpURLConnection buildRequest(ServiceClient client, Void parentObject, OperationContext context) throws Exception { return BaseRequest.getServiceStats( credentials.transformUri(client.getStorageUri().getUri(this.getCurrentLocation())), options, null, context); }
final OperationContext opContext, final ListingContext listingContext, final ContainerListingDetails detailsIncluded) throws URISyntaxException, IOException, StorageException { final UriQueryBuilder builder = BaseRequest.getListUriQueryBuilder(listingContext);
final OperationContext opContext) throws URISyntaxException, IOException, StorageException { final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, null, opContext);