/** * Gets the FileDirectoryAttributes 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 FileDirectoryAttributes from the given request. * @throws StorageException */ public static FileDirectoryAttributes getFileDirectoryAttributes(final HttpURLConnection request, final boolean usePathStyleUris) throws StorageException { final FileDirectoryAttributes directoryAttributes = new FileDirectoryAttributes(); URI tempURI; try { tempURI = PathUtility.stripSingleURIQueryAndFragment(request.getURL().toURI()); } catch (final URISyntaxException e) { final StorageException wrappedUnexpectedException = Utility.generateNewUnexpectedStorageException(e); throw wrappedUnexpectedException; } directoryAttributes.setName(PathUtility.getDirectoryNameFromURI(tempURI, usePathStyleUris)); final FileDirectoryProperties directoryProperties = directoryAttributes.getProperties(); directoryProperties.setEtag(BaseResponse.getEtag(request)); directoryProperties.setLastModified(new Date(request.getLastModified())); directoryAttributes.setMetadata(getMetadata(request)); directoryProperties.setServerEncrypted( Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED))); return directoryAttributes; }
/** * Gets the FileDirectoryAttributes 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 FileDirectoryAttributes from the given request. * @throws StorageException */ public static FileDirectoryAttributes getFileDirectoryAttributes(final HttpURLConnection request, final boolean usePathStyleUris) throws StorageException { final FileDirectoryAttributes directoryAttributes = new FileDirectoryAttributes(); URI tempURI; try { tempURI = PathUtility.stripSingleURIQueryAndFragment(request.getURL().toURI()); } catch (final URISyntaxException e) { final StorageException wrappedUnexpectedException = Utility.generateNewUnexpectedStorageException(e); throw wrappedUnexpectedException; } directoryAttributes.setName(PathUtility.getDirectoryNameFromURI(tempURI, usePathStyleUris)); final FileDirectoryProperties directoryProperties = directoryAttributes.getProperties(); directoryProperties.setEtag(BaseResponse.getEtag(request)); directoryProperties.setLastModified(new Date(request.getLastModified())); directoryAttributes.setMetadata(getMetadata(request)); directoryProperties.setServerEncrypted( Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED))); return directoryAttributes; }
/** * 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; }