microsoft-azure-storage/src/com/microsoft/azure/storage/core/Canonicalizer.java
protected static String canonicalizeHttpRequest(final java.net.URL address, final String accountName,
            final String method, final String contentType, final long contentLength, final String date,
            final HttpURLConnection conn) throws StorageException {

        // The first element should be the Method of the request.
        // I.e. GET, POST, PUT, or HEAD.
        final StringBuilder canonicalizedString = new StringBuilder(ExpectedBlobQueueCanonicalizedStringLength);
        canonicalizedString.append(conn.getRequestMethod());

        // The next elements are
        // If any element is missing it may be empty.
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_ENCODING));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_LANGUAGE));
        appendCanonicalizedElement(canonicalizedString,
                contentLength <= 0 ? Constants.EMPTY_STRING : String.valueOf(contentLength));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_MD5));
        appendCanonicalizedElement(canonicalizedString, contentType != null ? contentType : Constants.EMPTY_STRING);

        final String dateString = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.DATE);
        // If x-ms-date header exists, Date should be empty string
        appendCanonicalizedElement(canonicalizedString, dateString.equals(Constants.EMPTY_STRING) ? date
                : Constants.EMPTY_STRING);

        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_MODIFIED_SINCE));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_MATCH));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_NONE_MATCH));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_UNMODIFIED_SINCE));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.RANGE));

        addCanonicalizedHeaders(conn, canonicalizedString);

        appendCanonicalizedElement(canonicalizedString, getCanonicalizedResource(address, accountName));

        return canonicalizedString.toString();
    }
protected static String canonicalizeHttpRequest(final java.net.URL address, final String accountName,
            final String method, final String contentType, final long contentLength, final String date,
            final HttpURLConnection conn) throws StorageException {

        // The first element should be the Method of the request.
        // I.e. GET, POST, PUT, or HEAD.
        final StringBuilder canonicalizedString = new StringBuilder(ExpectedBlobQueueCanonicalizedStringLength);
        canonicalizedString.append(conn.getRequestMethod());

        // The next elements are
        // If any element is missing it may be empty.
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_ENCODING));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_LANGUAGE));
        appendCanonicalizedElement(canonicalizedString,
                contentLength <= 0 ? Constants.EMPTY_STRING : String.valueOf(contentLength));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_MD5));
        appendCanonicalizedElement(canonicalizedString, contentType != null ? contentType : Constants.EMPTY_STRING);

        final String dateString = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.DATE);
        // If x-ms-date header exists, Date should be empty string
        appendCanonicalizedElement(canonicalizedString, dateString.equals(Constants.EMPTY_STRING) ? date
                : Constants.EMPTY_STRING);

        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_MODIFIED_SINCE));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_MATCH));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_NONE_MATCH));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.IF_UNMODIFIED_SINCE));
        appendCanonicalizedElement(canonicalizedString,
                Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.RANGE));

        addCanonicalizedHeaders(conn, canonicalizedString);

        appendCanonicalizedElement(canonicalizedString, getCanonicalizedResource(address, accountName));

        return canonicalizedString.toString();
    }
protected static String canonicalizeHttpRequest ( final java . net . URL address , final String accountName , final String method , final String contentType , final long contentLength , final String date , final HttpURLConnection conn ) throws StorageException { // The first element should be the Method of the request. // I.e. GET, POST, PUT, or HEAD. final StringBuilder canonicalizedString = new StringBuilder ( ExpectedBlobQueueCanonicalizedStringLength ) ; canonicalizedString . append ( conn . getRequestMethod ( ) ) ; // The next elements are // If any element is missing it may be empty. appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . CONTENT_ENCODING ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . CONTENT_LANGUAGE ) ) ; appendCanonicalizedElement ( canonicalizedString , contentLength <= 0 ? Constants . EMPTY_STRING : String . valueOf ( contentLength ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . CONTENT_MD5 ) ) ; appendCanonicalizedElement ( canonicalizedString , contentType != null ? contentType : Constants . EMPTY_STRING ) ; final String dateString = Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . DATE ) ; // If x-ms-date header exists, Date should be empty string appendCanonicalizedElement ( canonicalizedString , dateString . equals ( Constants . EMPTY_STRING ) ? date : Constants . EMPTY_STRING ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . IF_MODIFIED_SINCE ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . IF_MATCH ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . IF_NONE_MATCH ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . IF_UNMODIFIED_SINCE ) ) ; appendCanonicalizedElement ( canonicalizedString , Utility . getStandardHeaderValue ( conn , Constants . HeaderConstants . RANGE ) ) ; addCanonicalizedHeaders ( conn , canonicalizedString ) ; appendCanonicalizedElement ( canonicalizedString , getCanonicalizedResource ( address , accountName ) ) ; return canonicalizedString . toString ( ) ; }
Constructs a canonicalized string from the request's headers that will be used to construct the signature string
for signing a Blob or Queue service request under the Shared Key Full authentication scheme.

@param address
the request URI
@param accountName
the account name associated with the request
@param method
the verb to be used for the HTTP request.
@param contentType
the content type of the HTTP request.
@param contentLength
the length of the content written to the outputstream in bytes, -1 if unknown
@param date
the date/time specification for the HTTP request
@param conn
the HttpURLConnection for the operation.
@return A canonicalized string.
@throws StorageException
Constructs a canonicalized string from the request s headers that will be used to construct the signature string for signing a Blob or Queue service request under the Shared Key Full authentication scheme .