protected static String getCanonicalizedResource(final java.net.URL address, final String accountName)
            throws StorageException {
        // Resource path
        final StringBuilder resourcepath = new StringBuilder("/");
        resourcepath.append(accountName);

        // Note that AbsolutePath starts with a '/'.
        resourcepath.append(address.getPath());
        final StringBuilder canonicalizedResource = new StringBuilder(resourcepath.toString());

        // query parameters
        if (address.getQuery() == null  || !address.getQuery().contains("=")) {
            //no query params.
            return canonicalizedResource.toString();
        }

        final Map<String, String[]> queryVariables = PathUtility.parseQueryString(address.getQuery());

        final Map<String, String> lowercasedKeyNameValue = new HashMap<String, String>();

        for (final Entry<String, String[]> entry : queryVariables.entrySet()) {
            // sort the value and organize it as comma separated values
            final List<String> sortedValues = Arrays.asList(entry.getValue());
            Collections.sort(sortedValues);

            final StringBuilder stringValue = new StringBuilder();

            for (final String value : sortedValues) {
                if (stringValue.length() > 0) {
                    stringValue.append(",");
                }

                stringValue.append(value);
            }

            // key turns out to be null for ?a&b&c&d
            lowercasedKeyNameValue.put((entry.getKey()) == null ? null :
                entry.getKey().toLowerCase(Utility.LOCALE_US), stringValue.toString());
        }

        final ArrayList<String> sortedKeys = new ArrayList<String>(lowercasedKeyNameValue.keySet());

        Collections.sort(sortedKeys);

        for (final String key : sortedKeys) {
            final StringBuilder queryParamString = new StringBuilder();

            queryParamString.append(key);
            queryParamString.append(":");
            queryParamString.append(lowercasedKeyNameValue.get(key));

            appendCanonicalizedElement(canonicalizedResource, queryParamString.toString());
        }

        return canonicalizedResource.toString();
    }
protected static String getCanonicalizedResource(final java.net.URL address, final String accountName)
            throws StorageException {
        
        final StringBuilder resourcepath = new StringBuilder("/");
        resourcepath.append(accountName);

        
        resourcepath.append(address.getPath());
        final StringBuilder canonicalizedResource = new StringBuilder(resourcepath.toString());

        
        if (address.getQuery() == null  || !address.getQuery().contains("=")) {
            
            return canonicalizedResource.toString();
        }

        final Map<String, String[]> queryVariables = PathUtility.parseQueryString(address.getQuery());

        final Map<String, String> lowercasedKeyNameValue = new HashMap<String, String>();

        for (final Entry<String, String[]> entry : queryVariables.entrySet()) {
            
            final List<String> sortedValues = Arrays.asList(entry.getValue());
            Collections.sort(sortedValues);

            final StringBuilder stringValue = new StringBuilder();

            for (final String value : sortedValues) {
                if (stringValue.length() > 0) {
                    stringValue.append(",");
                }

                stringValue.append(value);
            }

            
            lowercasedKeyNameValue.put((entry.getKey()) == null ? null :
                entry.getKey().toLowerCase(Utility.LOCALE_US), stringValue.toString());
        }

        final ArrayList<String> sortedKeys = new ArrayList<String>(lowercasedKeyNameValue.keySet());

        Collections.sort(sortedKeys);

        for (final String key : sortedKeys) {
            final StringBuilder queryParamString = new StringBuilder();

            queryParamString.append(key);
            queryParamString.append(":");
            queryParamString.append(lowercasedKeyNameValue.get(key));

            appendCanonicalizedElement(canonicalizedResource, queryParamString.toString());
        }

        return canonicalizedResource.toString();
    }
protected static String getCanonicalizedResource ( final java . net . URL address , final String accountName ) throws StorageException { // Resource path final StringBuilder resourcepath = new StringBuilder ( "/" ) ; resourcepath . append ( accountName ) ; // Note that AbsolutePath starts with a '/'. resourcepath . append ( address . getPath ( ) ) ; final StringBuilder canonicalizedResource = new StringBuilder ( resourcepath . toString ( ) ) ; // query parameters if ( address . getQuery ( ) == null || ! address . getQuery ( ) . contains ( "=" ) ) { //no query params. return canonicalizedResource . toString ( ) ; } final Map < String , String [ ] > queryVariables = PathUtility . parseQueryString ( address . getQuery ( ) ) ; final Map < String , String > lowercasedKeyNameValue = new HashMap < String , String > ( ) ; for ( final Entry < String , String [ ] > entry : queryVariables . entrySet ( ) ) { // sort the value and organize it as comma separated values final List < String > sortedValues = Arrays . asList ( entry . getValue ( ) ) ; Collections . sort ( sortedValues ) ; final StringBuilder stringValue = new StringBuilder ( ) ; for ( final String value : sortedValues ) { if ( stringValue . length ( ) > 0 ) { stringValue . append ( "," ) ; } stringValue . append ( value ) ; } // key turns out to be null for ?a&b&c&d lowercasedKeyNameValue . put ( ( entry . getKey ( ) ) == null ? null : entry . getKey ( ) . toLowerCase ( Utility . LOCALE_US ) , stringValue . toString ( ) ) ; } final ArrayList < String > sortedKeys = new ArrayList < String > ( lowercasedKeyNameValue . keySet ( ) ) ; Collections . sort ( sortedKeys ) ; for ( final String key : sortedKeys ) { final StringBuilder queryParamString = new StringBuilder ( ) ; queryParamString . append ( key ) ; queryParamString . append ( ":" ) ; queryParamString . append ( lowercasedKeyNameValue . get ( key ) ) ; appendCanonicalizedElement ( canonicalizedResource , queryParamString . toString ( ) ) ; } return canonicalizedResource . toString ( ) ; }
Gets the canonicalized resource string for a Blob or Queue service request under the Shared Key Lite
authentication scheme.

@param address
the resource URI.
@param accountName
the account name for the request.
@return the canonicalized resource string.
@throws StorageException
Gets the canonicalized resource string for a Blob or Queue service request under the Shared Key Lite authentication scheme .