private void updatePropertiesFromResponse(HttpURLConnection request) { // ETag this.getProperties().setEtag(request.getHeaderField(Constants.HeaderConstants.ETAG)); // Last Modified if (0 != request.getLastModified()) { final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US); lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE); lastModifiedCalendar.setTime(new Date(request.getLastModified())); this.getProperties().setLastModified(lastModifiedCalendar.getTime()); } }
private void updatePropertiesFromResponse(HttpURLConnection request) { if (this.getProperties() == null) { this.properties = new FileShareProperties(); } // ETag this.getProperties().setEtag(request.getHeaderField(Constants.HeaderConstants.ETAG)); // Last Modified if (0 != request.getLastModified()) { final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US); lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE); lastModifiedCalendar.setTime(new Date(request.getLastModified())); this.getProperties().setLastModified(lastModifiedCalendar.getTime()); } }
private void getProperties(String currentNode, String value) throws ParseException { if (currentNode.equals(Constants.LAST_MODIFIED_ELEMENT)) { this.attributes.getProperties().setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); } else if (currentNode.equals(Constants.ETAG_ELEMENT)) { this.attributes.getProperties().setEtag(Utility.formatETag(value)); } else if (currentNode.equals(FileConstants.SHARE_QUOTA_ELEMENT)) { this.attributes.getProperties().setShareQuota(Utility.isNullOrEmpty(value) ? null : Integer.parseInt(value)); } } }
private void getProperties(String currentNode, String value) throws ParseException { if (currentNode.equals(Constants.LAST_MODIFIED_ELEMENT)) { this.attributes.getProperties().setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); } else if (currentNode.equals(Constants.ETAG_ELEMENT)) { this.attributes.getProperties().setEtag(Utility.formatETag(value)); } else if (currentNode.equals(FileConstants.SHARE_QUOTA_ELEMENT)) { this.attributes.getProperties().setShareQuota(Utility.isNullOrEmpty(value) ? null : Integer.parseInt(value)); } } }
/** * Creates an instance of the <code>FileShareProperties</code> class by copying values from another * <code>FileShareProperties</code> instance. * * @param other * A {@link FileShareProperties} object which represents the file share properties to copy. */ public FileShareProperties(final FileShareProperties other) { if (other != null) { this.setEtag(other.getEtag()); this.setLastModified(other.getLastModified()); this.setShareQuota(other.getShareQuota()); } }
/** * Creates an instance of the <code>FileShareProperties</code> class by copying values from another * <code>FileShareProperties</code> instance. * * @param other * A {@link FileShareProperties} object which represents the file share properties to copy. */ public FileShareProperties(final FileShareProperties other) { if (other != null) { this.setEtag(other.getEtag()); this.setLastModified(other.getLastModified()); this.setShareQuota(other.getShareQuota()); } }
/** * Gets the FileShareAttributes from the given request. * * @param request * the request to get attributes from * @param usePathStyleUris * a value indicating if the account is using pathSytleUris * @return the FileShareAttributes from the given request. * @throws StorageException */ public static FileShareAttributes getFileShareAttributes(final HttpURLConnection request, final boolean usePathStyleUris) throws StorageException { final FileShareAttributes shareAttributes = new FileShareAttributes(); final FileShareProperties shareProperties = shareAttributes.getProperties(); shareProperties.setEtag(BaseResponse.getEtag(request)); shareProperties.setShareQuota(parseShareQuota(request)); shareProperties.setLastModified(new Date(request.getLastModified())); shareAttributes.setMetadata(getMetadata(request)); return shareAttributes; }
/** * Gets the FileShareAttributes from the given request. * * @param request * the request to get attributes from * @param usePathStyleUris * a value indicating if the account is using pathSytleUris * @return the FileShareAttributes from the given request. * @throws StorageException */ public static FileShareAttributes getFileShareAttributes(final HttpURLConnection request, final boolean usePathStyleUris) throws StorageException { final FileShareAttributes shareAttributes = new FileShareAttributes(); final FileShareProperties shareProperties = shareAttributes.getProperties(); shareProperties.setEtag(BaseResponse.getEtag(request)); shareProperties.setShareQuota(parseShareQuota(request)); shareProperties.setLastModified(new Date(request.getLastModified())); shareAttributes.setMetadata(getMetadata(request)); return shareAttributes; }