code: 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;
      }
docs: 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