public static HttpURLConnection getAccountInfo(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } builder.add(Constants.QueryConstants.RESOURCETYPE, ACCOUNT); builder.add(Constants.QueryConstants.COMPONENT, PROPERTIES); final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod("HEAD"); return retConnection; }
/** * Adds a queryString to an URI. * * @param resourceURI * the URI of the resource * @param fieldCollection * the key/ values collection to append. * @return an appended URI. * @throws URISyntaxException * if the resulting URI is invalid. * @throws StorageException */ public static URI addToSingleUriQuery(final URI resourceURI, final HashMap<String, String[]> fieldCollection) throws URISyntaxException, StorageException { if (resourceURI == null) { return null; } final UriQueryBuilder outUri = new UriQueryBuilder(); // Generate new queryString for (final Entry<String, String[]> entry : fieldCollection.entrySet()) { for (final String val : entry.getValue()) { outUri.add(entry.getKey(), val); } } return outUri.addToURI(resourceURI); }
/** * Adds a value to the URI with escaping. * * @param name * the query key name. * @param value * the query value. * @throws StorageException */ public void add(final String name, final String value) throws StorageException { if (Utility.isNullOrEmpty(name)) { throw new IllegalArgumentException(SR.QUERY_PARAMETER_NULL_OR_EMPTY); } this.insertKeyValue(name, value); }
/** * Adds the snapshot. * * @param builder * a query builder. * @param snapshotVersion * the snapshot version to the query builder. * @throws StorageException */ private static void addSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SNAPSHOT, snapshotVersion); } }
/** * Gets the properties. Sign with no length specified. * * @param uri * The Uri to query. * @param builder * The builder. * @param opContext * an object used to track the execution of the operation * @return a web request for performing the operation. * @throws StorageException * @throws URISyntaxException * @throws IOException * */ public static HttpURLConnection getProperties(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod(Constants.HTTP_HEAD); return retConnection; }
mimePart.op = qOp.getOperationType(); UriQueryBuilder builder = new UriQueryBuilder(); mimePart.requestIdentity = builder.addToURI(PathUtility.appendPathToSingleUri(baseUri, qOp.generateRequestIdentityWithTable(tableName))); mimePart.op = op.getOperationType(); UriQueryBuilder builder = new UriQueryBuilder(); mimePart.requestIdentity = builder.addToURI(PathUtility.appendPathToSingleUri(baseUri, op.generateRequestIdentityWithTable(tableName)));
final UriQueryBuilder builder = new UriQueryBuilder(); return new StorageCredentialsSharedAccessSignature(builder.toString());
null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", ipRange, protocols, signature); return builder.toString();
this.insertKeyValue(entry.getKey(), val); final String finalQuery = this.toString();
/** * Adds the snapshot. * * @param builder * a query builder. * @param snapshotVersion * the snapshot version to the query builder. * @throws StorageException */ private static void addSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SNAPSHOT, snapshotVersion); } }
/** * Deletes the specified resource. Sign with no length specified. * * @param uri * the request Uri. * @param builder * the UriQueryBuilder for the request * @param opContext * an object used to track the execution of the operation * @return a HttpURLConnection to perform the operation. * @throws IOException * if there is an error opening the connection * @throws URISyntaxException * if there is an improperly formated URI * @throws StorageException */ public static HttpURLConnection delete(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod(Constants.HTTP_DELETE); return retConnection; }
mimePart.op = qOp.getOperationType(); UriQueryBuilder builder = new UriQueryBuilder(); mimePart.requestIdentity = builder.addToURI(PathUtility.appendPathToSingleUri(baseUri, qOp.generateRequestIdentityWithTable(tableName))); mimePart.op = op.getOperationType(); UriQueryBuilder builder = new UriQueryBuilder(); mimePart.requestIdentity = builder.addToURI(PathUtility.appendPathToSingleUri(baseUri, op.generateRequestIdentityWithTable(tableName)));
final UriQueryBuilder builder = new UriQueryBuilder(); return new StorageCredentialsSharedAccessSignature(builder.toString());
/** * Returns a shared access signature for the account. * * @param policy * A {@link SharedAccessAccountPolicy} specifying the access policy for the shared access signature. * * @return The query string returned includes the leading question mark. * @throws StorageException * If a storage service error occurred. * @throws InvalidKeyException * If the key is invalid. */ public String generateSharedAccessSignature(SharedAccessAccountPolicy policy) throws InvalidKeyException, StorageException { if (!StorageCredentialsHelper.canCredentialsSignRequest(this.getCredentials())) { throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY); } final String sig = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForAccount( this.credentials.getAccountName(), policy, this.getCredentials()); final UriQueryBuilder sasBuilder = SharedAccessSignatureHelper.generateSharedAccessSignatureForAccount(policy, sig); return sasBuilder.toString(); }
this.insertKeyValue(entry.getKey(), val); final String finalQuery = this.toString();
/** * Gets the share Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the share. * * @throws StorageException */ private static UriQueryBuilder getDirectoryUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "directory"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Adds a queryString to an URI. * * @param resourceURI * the URI of the resource * @param fieldCollection * the key/ values collection to append. * @return an appended URI. * @throws URISyntaxException * if the resulting URI is invalid. * @throws StorageException */ public static URI addToSingleUriQuery(final URI resourceURI, final HashMap<String, String[]> fieldCollection) throws URISyntaxException, StorageException { if (resourceURI == null) { return null; } final UriQueryBuilder outUri = new UriQueryBuilder(); // Generate new queryString for (final Entry<String, String[]> entry : fieldCollection.entrySet()) { for (final String val : entry.getValue()) { outUri.add(entry.getKey(), val); } } return outUri.addToURI(resourceURI); }
/** * Adds the share snapshot if present. * Only for listing files and directories which requires a different query param. * * @param builder * a query builder. * @param snapshotVersion * the share snapshot version to the query builder. * @throws StorageException */ public static void addShareSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SHARE_SNAPSHOT, snapshotVersion); } }
/** * Gets the properties. Sign with no length specified. * * @param uri * The Uri to query. * @param timeout * The timeout. * @param builder * The builder. * @param opContext * an object used to track the execution of the operation * @return a web request for performing the operation. * @throws StorageException * @throws URISyntaxException * @throws IOException * */ public static HttpURLConnection getProperties(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod(Constants.HTTP_HEAD); return retConnection; }
policy, groupPolicyIdentifier, ipRange, protocols, signature); return builder.toString();