NetHttpTransport.smali
.class public final Lcom/google/api/client/http/javanet/NetHttpTransport;
.super Lcom/google/api/client/http/HttpTransport;
# static fields
.field private static final f:[Ljava/lang/String;
# instance fields
.field private final c:Lcom/google/api/client/http/javanet/ConnectionFactory;
.field private final d:Ljavax/net/ssl/SSLSocketFactory;
.field private final e:Ljavax/net/ssl/HostnameVerifier;
# direct methods
.method static constructor <clinit>()V
.registers 7
const-string v0, "DELETE"
const-string v1, "GET"
const-string v2, "HEAD"
const-string v3, "OPTIONS"
const-string v4, "POST"
const-string v5, "PUT"
const-string v6, "TRACE"
filled-new-array/range {v0 .. v6}, [Ljava/lang/String;
move-result-object v0
sput-object v0, Lcom/google/api/client/http/javanet/NetHttpTransport;->f:[Ljava/lang/String;
invoke-static {v0}, Ljava/util/Arrays;->sort([Ljava/lang/Object;)V
return-void
.end method
.method public constructor <init>()V
.registers 2
const/4 v0, 0x0
invoke-direct {p0, v0, v0, v0}, Lcom/google/api/client/http/javanet/NetHttpTransport;-><init>(Lcom/google/api/client/http/javanet/ConnectionFactory;Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/HostnameVerifier;)V
return-void
.end method
.method constructor <init>(Lcom/google/api/client/http/javanet/ConnectionFactory;Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/HostnameVerifier;)V
.registers 4
invoke-direct {p0}, Lcom/google/api/client/http/HttpTransport;-><init>()V
invoke-direct {p0, p1}, Lcom/google/api/client/http/javanet/NetHttpTransport;->h(Lcom/google/api/client/http/javanet/ConnectionFactory;)Lcom/google/api/client/http/javanet/ConnectionFactory;
move-result-object p1
iput-object p1, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->c:Lcom/google/api/client/http/javanet/ConnectionFactory;
iput-object p2, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->d:Ljavax/net/ssl/SSLSocketFactory;
iput-object p3, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->e:Ljavax/net/ssl/HostnameVerifier;
return-void
.end method
.method private static g()Ljava/net/Proxy;
.registers 5
new-instance v0, Ljava/net/Proxy;
sget-object v1, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
new-instance v2, Ljava/net/InetSocketAddress;
const-string v3, "https.proxyHost"
invoke-static {v3}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
const-string v4, "https.proxyPort"
invoke-static {v4}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String;
move-result-object v4
invoke-static {v4}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v4
invoke-direct {v2, v3, v4}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V
invoke-direct {v0, v1, v2}, Ljava/net/Proxy;-><init>(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V
return-object v0
.end method
.method private h(Lcom/google/api/client/http/javanet/ConnectionFactory;)Lcom/google/api/client/http/javanet/ConnectionFactory;
.registers 3
if-nez p1, :cond_19
const-string p1, "com.google.api.client.should_use_proxy"
invoke-static {p1}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
if-eqz p1, :cond_14
new-instance p1, Lcom/google/api/client/http/javanet/DefaultConnectionFactory;
invoke-static {}, Lcom/google/api/client/http/javanet/NetHttpTransport;->g()Ljava/net/Proxy;
move-result-object v0
invoke-direct {p1, v0}, Lcom/google/api/client/http/javanet/DefaultConnectionFactory;-><init>(Ljava/net/Proxy;)V
return-object p1
:cond_14
new-instance p1, Lcom/google/api/client/http/javanet/DefaultConnectionFactory;
invoke-direct {p1}, Lcom/google/api/client/http/javanet/DefaultConnectionFactory;-><init>()V
:cond_19
return-object p1
.end method
# virtual methods
.method protected bridge synthetic b(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/http/LowLevelHttpRequest;
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
invoke-virtual {p0, p1, p2}, Lcom/google/api/client/http/javanet/NetHttpTransport;->f(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/http/javanet/NetHttpRequest;
move-result-object p1
return-object p1
.end method
.method public e(Ljava/lang/String;)Z
.registers 3
sget-object v0, Lcom/google/api/client/http/javanet/NetHttpTransport;->f:[Ljava/lang/String;
invoke-static {v0, p1}, Ljava/util/Arrays;->binarySearch([Ljava/lang/Object;Ljava/lang/Object;)I
move-result p1
if-ltz p1, :cond_a
const/4 p1, 0x1
goto :goto_b
:cond_a
const/4 p1, 0x0
:goto_b
return p1
.end method
.method protected f(Ljava/lang/String;Ljava/lang/String;)Lcom/google/api/client/http/javanet/NetHttpRequest;
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
invoke-virtual {p0, p1}, Lcom/google/api/client/http/javanet/NetHttpTransport;->e(Ljava/lang/String;)Z
move-result v0
const/4 v1, 0x1
new-array v1, v1, [Ljava/lang/Object;
const/4 v2, 0x0
aput-object p1, v1, v2
const-string v2, "HTTP method %s not supported"
invoke-static {v0, v2, v1}, Lcom/google/api/client/util/Preconditions;->c(ZLjava/lang/String;[Ljava/lang/Object;)V
new-instance v0, Ljava/net/URL;
invoke-direct {v0, p2}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
iget-object p2, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->c:Lcom/google/api/client/http/javanet/ConnectionFactory;
invoke-interface {p2, v0}, Lcom/google/api/client/http/javanet/ConnectionFactory;->a(Ljava/net/URL;)Ljava/net/HttpURLConnection;
move-result-object p2
invoke-virtual {p2, p1}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
instance-of p1, p2, Ljavax/net/ssl/HttpsURLConnection;
if-eqz p1, :cond_32
move-object p1, p2
check-cast p1, Ljavax/net/ssl/HttpsURLConnection;
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->e:Ljavax/net/ssl/HostnameVerifier;
if-eqz v0, :cond_2b
invoke-virtual {p1, v0}, Ljavax/net/ssl/HttpsURLConnection;->setHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V
:cond_2b
iget-object v0, p0, Lcom/google/api/client/http/javanet/NetHttpTransport;->d:Ljavax/net/ssl/SSLSocketFactory;
if-eqz v0, :cond_32
invoke-virtual {p1, v0}, Ljavax/net/ssl/HttpsURLConnection;->setSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V
:cond_32
new-instance p1, Lcom/google/api/client/http/javanet/NetHttpRequest;
invoke-direct {p1, p2}, Lcom/google/api/client/http/javanet/NetHttpRequest;-><init>(Ljava/net/HttpURLConnection;)V
return-object p1
.end method