/** * Returns the canonical name of the blob in the format of * <i>/<service-name>/<account-name>/<container-name>/<blob-name></i>. * <p> * This format is used for Shared Access operations. * * @param ignoreSnapshotTime * <code>true</code> if the snapshot time is ignored; otherwise, <code>false</code>. * * @return The canonical name in the format of <i>/<service-name>/<account-name> * /<container-name>/<blob-name></i>. */ String getCanonicalName(final boolean ignoreSnapshotTime) { StringBuilder canonicalName = new StringBuilder("/"); canonicalName.append(SR.BLOB); if (this.blobServiceClient.isUsePathStyleUris()) { canonicalName.append(this.getUri().getRawPath()); } else { canonicalName.append(PathUtility.getCanonicalPathFromCredentials( this.blobServiceClient.getCredentials(), this.getUri().getRawPath())); } if (!ignoreSnapshotTime && this.snapshotID != null) { canonicalName.append("?snapshot="); canonicalName.append(this.snapshotID); } return canonicalName.toString(); }
/** * Returns the canonical name of the blob in the format of * <i>/<service-name>/<account-name>/<container-name>/<blob-name></i>. * <p> * This format is used for Shared Access operations. * * @param ignoreSnapshotTime * <code>true</code> if the snapshot time is ignored; otherwise, <code>false</code>. * * @return The canonical name in the format of <i>/<service-name>/<account-name> * /<container-name>/<blob-name></i>. */ String getCanonicalName(final boolean ignoreSnapshotTime) { StringBuilder canonicalName = new StringBuilder("/"); canonicalName.append(SR.BLOB); if (this.blobServiceClient.isUsePathStyleUris()) { canonicalName.append(this.getUri().getRawPath()); } else { canonicalName.append(PathUtility.getCanonicalPathFromCredentials( this.blobServiceClient.getCredentials(), this.getUri().getRawPath())); } if (!ignoreSnapshotTime && this.snapshotID != null) { canonicalName.append("?snapshot="); canonicalName.append(this.snapshotID); } return canonicalName.toString(); }
/** * Returns the blob's container. * * @return A {@link CloudBlobContainer} object that represents the container of the blob. * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public final CloudBlobContainer getContainer() throws StorageException, URISyntaxException { if (this.container == null) { final StorageUri containerURI = PathUtility.getContainerURI(this.getStorageUri(), this.blobServiceClient.isUsePathStyleUris()); this.container = new CloudBlobContainer(containerURI, this.blobServiceClient.getCredentials()); } return this.container; }
/** * Returns the blob's container. * * @return A {@link CloudBlobContainer} object that represents the container of the blob. * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public final CloudBlobContainer getContainer() throws StorageException, URISyntaxException { if (this.container == null) { final StorageUri containerURI = PathUtility.getContainerURI(this.getStorageUri(), this.blobServiceClient.isUsePathStyleUris()); this.container = new CloudBlobContainer(containerURI, this.blobServiceClient.getCredentials()); } return this.container; }
@Override public Boolean preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.metadata = attributes.getMetadata(); container.properties = attributes.getProperties(); container.name = attributes.getName(); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Boolean preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.metadata = attributes.getMetadata(); container.properties = attributes.getProperties(); container.name = attributes.getName(); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.metadata = attributes.getMetadata(); container.properties = attributes.getProperties(); container.name = attributes.getName(); return null; } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.metadata = attributes.getMetadata(); container.properties = attributes.getProperties(); container.name = attributes.getName(); return null; } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.properties = attributes.getProperties(); container.name = attributes.getName(); if (accessType != null) { container.properties.setPublicAccess(accessType); } else { container.properties.setPublicAccess(BlobContainerPublicAccessType.OFF); } return null; } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.properties = attributes.getProperties(); container.name = attributes.getName(); if (accessType != null) { container.properties.setPublicAccess(accessType); } else { container.properties.setPublicAccess(BlobContainerPublicAccessType.OFF); } return null; } };