@Override public CloudBlob preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } CloudBlob snapshot = null; final String snapshotTime = BlobResponse.getSnapshotTime(this.getConnection()); if (blob instanceof CloudBlockBlob) { snapshot = new CloudBlockBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } else if (blob instanceof CloudPageBlob) { snapshot = new CloudPageBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } else if (blob instanceof CloudAppendBlob) { snapshot = new CloudAppendBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } snapshot.setProperties(blob.properties); // use the specified metadata if not null : otherwise blob's metadata snapshot.setMetadata(metadata != null ? metadata : blob.metadata); snapshot.updateEtagAndLastModifiedFromResponse(this.getConnection()); return snapshot; } };
@Override public CloudBlob preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } CloudBlob snapshot = null; final String snapshotTime = BlobResponse.getSnapshotTime(this.getConnection()); if (blob instanceof CloudBlockBlob) { snapshot = new CloudBlockBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } else if (blob instanceof CloudPageBlob) { snapshot = new CloudPageBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } else if (blob instanceof CloudAppendBlob) { snapshot = new CloudAppendBlob(blob.getName(), snapshotTime, CloudBlob.this.getContainer()); } snapshot.setProperties(blob.properties); // use the specified metadata if not null : otherwise blob's metadata snapshot.setMetadata(metadata != null ? metadata : blob.metadata); snapshot.updateEtagAndLastModifiedFromResponse(this.getConnection()); return snapshot; } };