protected void updateLengthFromResponse(HttpURLConnection request) { final String xContentLengthHeader = request.getHeaderField(FileConstants.CONTENT_LENGTH_HEADER); if (!Utility.isNullOrEmpty(xContentLengthHeader)) { this.getProperties().setLength(Long.parseLong(xContentLengthHeader)); } }
protected void updateLengthFromResponse(HttpURLConnection request) { final String xContentLengthHeader = request.getHeaderField(FileConstants.CONTENT_LENGTH_HEADER); if (!Utility.isNullOrEmpty(xContentLengthHeader)) { this.getProperties().setLength(Long.parseLong(xContentLengthHeader)); } }
private void setProperties(String currentNode, String value) throws ParseException { // Called in both the file and the directory case. if (Constants.LAST_MODIFIED_ELEMENT.equals(currentNode)) { this.directoryProperties.setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); } else if (Constants.ETAG_ELEMENT.equals(currentNode)) { this.directoryProperties.setEtag(Utility.formatETag(value)); } else if (Constants.HeaderConstants.CONTENT_LENGTH.equals(currentNode)) { this.fileProperties.setLength(Long.parseLong(value)); } } }
private void setProperties(String currentNode, String value) throws ParseException { // Called in both the file and the directory case. if (Constants.LAST_MODIFIED_ELEMENT.equals(currentNode)) { this.directoryProperties.setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); } else if (Constants.ETAG_ELEMENT.equals(currentNode)) { this.directoryProperties.setEtag(Utility.formatETag(value)); } else if (Constants.HeaderConstants.CONTENT_LENGTH.equals(currentNode)) { this.fileProperties.setLength(Long.parseLong(value)); } } }
request.setRequestProperty(FileConstants.CONTENT_LENGTH_HEADER, String.valueOf(fileSize)); properties.setLength(fileSize);
request.setRequestProperty(FileConstants.CONTENT_LENGTH_HEADER, String.valueOf(fileSize)); properties.setLength(fileSize);
@Override public Void preProcessResponse(CloudFile file, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } file.getProperties().setLength(size); file.updateEtagAndLastModifiedFromResponse(this.getConnection()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); return null; } };
@Override public Void preProcessResponse(CloudFile file, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } file.getProperties().setLength(size); file.updateEtagAndLastModifiedFromResponse(this.getConnection()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); return null; } };