Java 类com.amazonaws.util.HttpUtils 实例源码

项目:aws-sdk-android-samples    文件:LoginRequest.java   
@Override
public String buildRequestUrl() {
    String url = this.endpoint.toString();

    StringBuilder builder = new StringBuilder(url);
    if (!url.endsWith("/")) {
        builder.append("/");
    }

    String timestamp = Utilities.getTimestamp();
    String signature = Utilities
            .getSignature(timestamp, this.decryptionKey);

    builder.append("login");
    builder.append("?uid=" + HttpUtils.urlEncode(this.uid, false));
    builder.append("&username=" + HttpUtils.urlEncode(this.username, false));
    builder.append("&timestamp=" + HttpUtils.urlEncode(timestamp, false));
    builder.append("&signature=" + HttpUtils.urlEncode(signature, false));

    return builder.toString();
}
项目:ExerciseMe    文件:RegisterDeviceRequest.java   
public String buildRequestUrl() {
    StringBuilder builder = new StringBuilder( ( this.useSSL ? "https://" : "http://" ) );
    builder.append( this.endpoint );
    builder.append( "/" );
    builder.append( "registerdevice" );
    builder.append( "?uid=" + HttpUtils.urlEncode( this.uid, false ) );
    builder.append( "&key=" + HttpUtils.urlEncode( this.key, false ) );

    return builder.toString();
}
项目:ExerciseMe    文件:GetTokenRequest.java   
public String buildRequestUrl() {
    StringBuilder builder = new StringBuilder( ( this.useSSL ? "https://" : "http://" ) );
    builder.append( this.endpoint );
    builder.append( "/" );

    String timestamp = Utilities.getTimestamp();
    String signature = Utilities.getSignature( timestamp, key );

    builder.append( "gettoken" );
    builder.append( "?uid=" + HttpUtils.urlEncode( this.uid, false ) );
    builder.append( "&timestamp=" + HttpUtils.urlEncode( timestamp, false ) );
    builder.append( "&signature=" + HttpUtils.urlEncode( signature, false ) );

    return builder.toString();
}
项目:amazon-cognito-developer-authentication-sample    文件:Utilities.java   
public static String encode(String s) {
    if (null == s)
        return s;
    return HttpUtils.urlEncode(s, false);
}
项目:reinvent2013-mobile-photo-share    文件:Utilities.java   
public static String encode(String s) {
    if (null == s)
        return s;
    return HttpUtils.urlEncode(s, false);
}
项目:aws-sdk-android-samples    文件:GetTokenRequest.java   
@Override
public String buildRequestUrl() {
    String url = this.endpoint.toString();

    StringBuilder builder = new StringBuilder(url);
    if (!url.endsWith("/")) {
        builder.append("/");
    }

    String timestamp = Utilities.getTimestamp();

    builder.append("gettoken");
    builder.append("?uid=" + HttpUtils.urlEncode(this.uid, false));
    builder.append("&timestamp=" + HttpUtils.urlEncode(timestamp, false));

    int counter = 1;

    StringBuilder loginString = new StringBuilder();
    for (Map.Entry<String, String> entry : logins.entrySet()) {
        loginString.append(entry.getKey() + entry.getValue());
        builder.append("&provider");
        builder.append(counter);
        builder.append("=");
        builder.append(HttpUtils.urlEncode(entry.getKey(), false));
        builder.append("&token");
        builder.append(counter);
        builder.append("=");
        builder.append(HttpUtils.urlEncode(entry.getValue(), false));
        counter++;
    }

    builder.append("&identityId=" + HttpUtils.urlEncode(identityId, false));

    String signature = null;
    if (identityId != null) {
        signature = Utilities.getSignature(timestamp + loginString + identityId, key);
    } else {
        signature = Utilities.getSignature(timestamp + loginString, key);
    }
    builder.append("&signature=" + HttpUtils.urlEncode(signature, false));
    return builder.toString();
}