You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
991 lines
24 KiB
991 lines
24 KiB
.class public Lcom/viatech/util/HttpRequestManager; |
|
.super Ljava/lang/Object; |
|
.source "HttpRequestManager.java" |
|
|
|
|
|
# annotations |
|
.annotation system Ldalvik/annotation/MemberClasses; |
|
value = { |
|
Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener; |
|
} |
|
.end annotation |
|
|
|
|
|
# static fields |
|
.field static final DO_NOT_VERIFY:Ljavax/net/ssl/HostnameVerifier; |
|
|
|
.field private static final TAG:Ljava/lang/String; = "Vpai_HttpRequestManager" |
|
|
|
.field private static sIns:Lcom/viatech/util/HttpRequestManager; |
|
|
|
|
|
# instance fields |
|
.field private mWorkHandler:Landroid/os/Handler; |
|
|
|
.field private mWorkThread:Landroid/os/HandlerThread; |
|
|
|
|
|
# direct methods |
|
.method static constructor <clinit>()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 348 |
|
new-instance v0, Lcom/viatech/util/HttpRequestManager$5; |
|
|
|
invoke-direct {v0}, Lcom/viatech/util/HttpRequestManager$5;-><init>()V |
|
|
|
sput-object v0, Lcom/viatech/util/HttpRequestManager;->DO_NOT_VERIFY:Ljavax/net/ssl/HostnameVerifier; |
|
|
|
return-void |
|
.end method |
|
|
|
.method private constructor <init>()V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 36 |
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V |
|
|
|
.line 37 |
|
new-instance v0, Landroid/os/HandlerThread; |
|
|
|
const-string v1, "http work" |
|
|
|
invoke-direct {v0, v1}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/HttpRequestManager;->mWorkThread:Landroid/os/HandlerThread; |
|
|
|
.line 38 |
|
iget-object v0, p0, Lcom/viatech/util/HttpRequestManager;->mWorkThread:Landroid/os/HandlerThread; |
|
|
|
invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V |
|
|
|
.line 39 |
|
new-instance v0, Landroid/os/Handler; |
|
|
|
iget-object v1, p0, Lcom/viatech/util/HttpRequestManager;->mWorkThread:Landroid/os/HandlerThread; |
|
|
|
invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper; |
|
|
|
move-result-object v1 |
|
|
|
invoke-direct {v0, v1}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/HttpRequestManager;->mWorkHandler:Landroid/os/Handler; |
|
|
|
.line 40 |
|
return-void |
|
.end method |
|
|
|
.method static synthetic access$000(Lcom/viatech/util/HttpRequestManager;Ljava/io/InputStream;)[B |
|
.locals 1 |
|
|
|
.prologue |
|
.line 28 |
|
invoke-direct {p0, p1}, Lcom/viatech/util/HttpRequestManager;->getBytesByInputStream(Ljava/io/InputStream;)[B |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method static synthetic access$100(Lcom/viatech/util/HttpRequestManager;[B)Ljava/lang/String; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 28 |
|
invoke-direct {p0, p1}, Lcom/viatech/util/HttpRequestManager;->getStringByBytes([B)Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method static synthetic access$200()V |
|
.locals 0 |
|
|
|
.prologue |
|
.line 28 |
|
invoke-static {}, Lcom/viatech/util/HttpRequestManager;->trustAllHosts()V |
|
|
|
return-void |
|
.end method |
|
|
|
.method private static create()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 43 |
|
new-instance v0, Lcom/viatech/util/HttpRequestManager; |
|
|
|
invoke-direct {v0}, Lcom/viatech/util/HttpRequestManager;-><init>()V |
|
|
|
sput-object v0, Lcom/viatech/util/HttpRequestManager;->sIns:Lcom/viatech/util/HttpRequestManager; |
|
|
|
.line 44 |
|
return-void |
|
.end method |
|
|
|
.method public static destory()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 47 |
|
sget-object v0, Lcom/viatech/util/HttpRequestManager;->sIns:Lcom/viatech/util/HttpRequestManager; |
|
|
|
iget-object v0, v0, Lcom/viatech/util/HttpRequestManager;->mWorkThread:Landroid/os/HandlerThread; |
|
|
|
invoke-virtual {v0}, Landroid/os/HandlerThread;->quit()Z |
|
|
|
.line 48 |
|
return-void |
|
.end method |
|
|
|
.method private getBytesByInputStream(Ljava/io/InputStream;)[B |
|
.locals 7 |
|
|
|
.prologue |
|
.line 103 |
|
const/4 v0, 0x0 |
|
|
|
.line 104 |
|
new-instance v2, Ljava/io/BufferedInputStream; |
|
|
|
invoke-direct {v2, p1}, Ljava/io/BufferedInputStream;-><init>(Ljava/io/InputStream;)V |
|
|
|
.line 105 |
|
new-instance v1, Ljava/io/ByteArrayOutputStream; |
|
|
|
invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V |
|
|
|
.line 106 |
|
new-instance v3, Ljava/io/BufferedOutputStream; |
|
|
|
invoke-direct {v3, v1}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V |
|
|
|
.line 107 |
|
const/16 v4, 0x2000 |
|
|
|
new-array v4, v4, [B |
|
|
|
.line 110 |
|
:goto_0 |
|
:try_start_0 |
|
invoke-virtual {v2, v4}, Ljava/io/BufferedInputStream;->read([B)I |
|
|
|
move-result v5 |
|
|
|
if-lez v5, :cond_0 |
|
|
|
.line 111 |
|
const/4 v6, 0x0 |
|
|
|
invoke-virtual {v3, v4, v6, v5}, Ljava/io/BufferedOutputStream;->write([BII)V |
|
:try_end_0 |
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
goto :goto_0 |
|
|
|
.line 115 |
|
:catch_0 |
|
move-exception v1 |
|
|
|
.line 116 |
|
:try_start_1 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
:try_end_1 |
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0 |
|
|
|
.line 119 |
|
:try_start_2 |
|
invoke-virtual {v3}, Ljava/io/BufferedOutputStream;->close()V |
|
:try_end_2 |
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_3 |
|
|
|
.line 124 |
|
:goto_1 |
|
:try_start_3 |
|
invoke-virtual {v2}, Ljava/io/BufferedInputStream;->close()V |
|
:try_end_3 |
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_4 |
|
|
|
.line 130 |
|
:goto_2 |
|
return-object v0 |
|
|
|
.line 113 |
|
:cond_0 |
|
:try_start_4 |
|
invoke-virtual {v3}, Ljava/io/BufferedOutputStream;->flush()V |
|
|
|
.line 114 |
|
invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B |
|
:try_end_4 |
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0 |
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0 |
|
|
|
move-result-object v0 |
|
|
|
.line 119 |
|
:try_start_5 |
|
invoke-virtual {v3}, Ljava/io/BufferedOutputStream;->close()V |
|
:try_end_5 |
|
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_2 |
|
|
|
.line 124 |
|
:goto_3 |
|
:try_start_6 |
|
invoke-virtual {v2}, Ljava/io/BufferedInputStream;->close()V |
|
:try_end_6 |
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_1 |
|
|
|
goto :goto_2 |
|
|
|
.line 125 |
|
:catch_1 |
|
move-exception v1 |
|
|
|
.line 126 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_2 |
|
|
|
.line 120 |
|
:catch_2 |
|
move-exception v1 |
|
|
|
.line 121 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_3 |
|
|
|
.line 120 |
|
:catch_3 |
|
move-exception v1 |
|
|
|
.line 121 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_1 |
|
|
|
.line 125 |
|
:catch_4 |
|
move-exception v1 |
|
|
|
.line 126 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_2 |
|
|
|
.line 118 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
.line 119 |
|
:try_start_7 |
|
invoke-virtual {v3}, Ljava/io/BufferedOutputStream;->close()V |
|
:try_end_7 |
|
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_5 |
|
|
|
.line 124 |
|
:goto_4 |
|
:try_start_8 |
|
invoke-virtual {v2}, Ljava/io/BufferedInputStream;->close()V |
|
:try_end_8 |
|
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_6 |
|
|
|
.line 128 |
|
:goto_5 |
|
throw v0 |
|
|
|
.line 120 |
|
:catch_5 |
|
move-exception v1 |
|
|
|
.line 121 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_4 |
|
|
|
.line 125 |
|
:catch_6 |
|
move-exception v1 |
|
|
|
.line 126 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_5 |
|
.end method |
|
|
|
.method private getStringByBytes([B)Ljava/lang/String; |
|
.locals 3 |
|
|
|
.prologue |
|
.line 93 |
|
const-string v1, "" |
|
|
|
.line 95 |
|
:try_start_0 |
|
new-instance v0, Ljava/lang/String; |
|
|
|
const-string v2, "UTF-8" |
|
|
|
invoke-direct {v0, p1, v2}, Ljava/lang/String;-><init>([BLjava/lang/String;)V |
|
:try_end_0 |
|
.catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_0} :catch_0 |
|
|
|
.line 99 |
|
:goto_0 |
|
return-object v0 |
|
|
|
.line 96 |
|
:catch_0 |
|
move-exception v0 |
|
|
|
.line 97 |
|
invoke-virtual {v0}, Ljava/io/UnsupportedEncodingException;->printStackTrace()V |
|
|
|
move-object v0, v1 |
|
|
|
goto :goto_0 |
|
.end method |
|
|
|
.method public static httpGet(Ljava/lang/String;)Ljava/lang/String; |
|
.locals 8 |
|
|
|
.prologue |
|
const/4 v1, 0x0 |
|
|
|
.line 299 |
|
.line 304 |
|
:try_start_0 |
|
new-instance v2, Ljava/net/URL; |
|
|
|
invoke-direct {v2, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V |
|
:try_end_0 |
|
.catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_2 |
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0 |
|
|
|
.line 307 |
|
:try_start_1 |
|
invoke-static {}, Lcom/viatech/util/HttpRequestManager;->trustAllHosts()V |
|
|
|
.line 308 |
|
invoke-virtual {v2}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Ljavax/net/ssl/HttpsURLConnection; |
|
|
|
.line 309 |
|
invoke-virtual {v2}, Ljava/net/URL;->getProtocol()Ljava/lang/String; |
|
|
|
move-result-object v3 |
|
|
|
invoke-virtual {v3}, Ljava/lang/String;->toLowerCase()Ljava/lang/String; |
|
|
|
move-result-object v3 |
|
|
|
const-string v4, "https" |
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z |
|
|
|
move-result v3 |
|
|
|
if-eqz v3, :cond_3 |
|
|
|
.line 310 |
|
sget-object v2, Lcom/viatech/util/HttpRequestManager;->DO_NOT_VERIFY:Ljavax/net/ssl/HostnameVerifier; |
|
|
|
invoke-virtual {v0, v2}, Ljavax/net/ssl/HttpsURLConnection;->setHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V |
|
:try_end_1 |
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_8 |
|
.catch Ljava/net/MalformedURLException; {:try_start_1 .. :try_end_1} :catch_2 |
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0 |
|
|
|
move-object v2, v0 |
|
|
|
.line 315 |
|
:goto_0 |
|
:try_start_2 |
|
new-instance v4, Ljava/io/BufferedReader; |
|
|
|
new-instance v0, Ljava/io/InputStreamReader; |
|
|
|
invoke-virtual {v2}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream; |
|
|
|
move-result-object v3 |
|
|
|
invoke-direct {v0, v3}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V |
|
|
|
invoke-direct {v4, v0}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V |
|
:try_end_2 |
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_9 |
|
.catch Ljava/net/MalformedURLException; {:try_start_2 .. :try_end_2} :catch_5 |
|
.catchall {:try_start_2 .. :try_end_2} :catchall_1 |
|
|
|
.line 316 |
|
:try_start_3 |
|
new-instance v3, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V |
|
:try_end_3 |
|
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_a |
|
.catch Ljava/net/MalformedURLException; {:try_start_3 .. :try_end_3} :catch_6 |
|
.catchall {:try_start_3 .. :try_end_3} :catchall_2 |
|
|
|
.line 317 |
|
:try_start_4 |
|
const-string v0, "Vpai_HttpRequestManager" |
|
|
|
new-instance v5, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v6, "sb:" |
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v5 |
|
|
|
invoke-static {v0, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 319 |
|
:goto_1 |
|
invoke-virtual {v4}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
if-eqz v0, :cond_0 |
|
|
|
.line 320 |
|
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
const-string v5, "\n" |
|
|
|
invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
:try_end_4 |
|
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0 |
|
.catch Ljava/net/MalformedURLException; {:try_start_4 .. :try_end_4} :catch_7 |
|
.catchall {:try_start_4 .. :try_end_4} :catchall_2 |
|
|
|
goto :goto_1 |
|
|
|
.line 322 |
|
:catch_0 |
|
move-exception v0 |
|
|
|
.line 323 |
|
:goto_2 |
|
:try_start_5 |
|
const-string v5, "Vpai_HttpRequestManager" |
|
|
|
new-instance v6, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v7, "1IOException:" |
|
|
|
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String; |
|
|
|
move-result-object v7 |
|
|
|
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v6 |
|
|
|
invoke-static {v5, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 324 |
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V |
|
:try_end_5 |
|
.catch Ljava/net/MalformedURLException; {:try_start_5 .. :try_end_5} :catch_7 |
|
.catchall {:try_start_5 .. :try_end_5} :catchall_2 |
|
|
|
.line 331 |
|
:cond_0 |
|
if-eqz v4, :cond_1 |
|
|
|
.line 333 |
|
:try_start_6 |
|
invoke-virtual {v4}, Ljava/io/BufferedReader;->close()V |
|
:try_end_6 |
|
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_1 |
|
|
|
.line 340 |
|
:cond_1 |
|
:goto_3 |
|
if-eqz v2, :cond_2 |
|
|
|
.line 341 |
|
invoke-virtual {v2}, Ljava/net/HttpURLConnection;->disconnect()V |
|
|
|
.line 345 |
|
:cond_2 |
|
:goto_4 |
|
if-nez v3, :cond_7 |
|
|
|
move-object v0, v1 |
|
|
|
:goto_5 |
|
return-object v0 |
|
|
|
.line 313 |
|
:cond_3 |
|
:try_start_7 |
|
invoke-virtual {v2}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection; |
|
|
|
move-result-object v0 |
|
|
|
check-cast v0, Ljava/net/HttpURLConnection; |
|
:try_end_7 |
|
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_8 |
|
.catch Ljava/net/MalformedURLException; {:try_start_7 .. :try_end_7} :catch_2 |
|
.catchall {:try_start_7 .. :try_end_7} :catchall_0 |
|
|
|
move-object v2, v0 |
|
|
|
goto :goto_0 |
|
|
|
.line 334 |
|
:catch_1 |
|
move-exception v0 |
|
|
|
.line 335 |
|
const-string v4, "Vpai_HttpRequestManager" |
|
|
|
new-instance v5, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v6, "2IOException:" |
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v5 |
|
|
|
invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 336 |
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_3 |
|
|
|
.line 326 |
|
:catch_2 |
|
move-exception v0 |
|
|
|
move-object v2, v1 |
|
|
|
move-object v3, v1 |
|
|
|
move-object v4, v1 |
|
|
|
.line 327 |
|
:goto_6 |
|
:try_start_8 |
|
const-string v5, "Vpai_HttpRequestManager" |
|
|
|
new-instance v6, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v7, "MalformedURLException:" |
|
|
|
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v0}, Ljava/net/MalformedURLException;->toString()Ljava/lang/String; |
|
|
|
move-result-object v7 |
|
|
|
invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v6 |
|
|
|
invoke-static {v5, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 328 |
|
invoke-virtual {v0}, Ljava/net/MalformedURLException;->printStackTrace()V |
|
:try_end_8 |
|
.catchall {:try_start_8 .. :try_end_8} :catchall_2 |
|
|
|
.line 331 |
|
if-eqz v4, :cond_4 |
|
|
|
.line 333 |
|
:try_start_9 |
|
invoke-virtual {v4}, Ljava/io/BufferedReader;->close()V |
|
:try_end_9 |
|
.catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_3 |
|
|
|
.line 340 |
|
:cond_4 |
|
:goto_7 |
|
if-eqz v2, :cond_2 |
|
|
|
.line 341 |
|
invoke-virtual {v2}, Ljava/net/HttpURLConnection;->disconnect()V |
|
|
|
goto :goto_4 |
|
|
|
.line 334 |
|
:catch_3 |
|
move-exception v0 |
|
|
|
.line 335 |
|
const-string v4, "Vpai_HttpRequestManager" |
|
|
|
new-instance v5, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v6, "2IOException:" |
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String; |
|
|
|
move-result-object v6 |
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v5 |
|
|
|
invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 336 |
|
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_7 |
|
|
|
.line 331 |
|
:catchall_0 |
|
move-exception v0 |
|
|
|
move-object v2, v1 |
|
|
|
move-object v4, v1 |
|
|
|
:goto_8 |
|
if-eqz v4, :cond_5 |
|
|
|
.line 333 |
|
:try_start_a |
|
invoke-virtual {v4}, Ljava/io/BufferedReader;->close()V |
|
:try_end_a |
|
.catch Ljava/io/IOException; {:try_start_a .. :try_end_a} :catch_4 |
|
|
|
.line 340 |
|
:cond_5 |
|
:goto_9 |
|
if-eqz v2, :cond_6 |
|
|
|
.line 341 |
|
invoke-virtual {v2}, Ljava/net/HttpURLConnection;->disconnect()V |
|
|
|
.line 343 |
|
:cond_6 |
|
throw v0 |
|
|
|
.line 334 |
|
:catch_4 |
|
move-exception v1 |
|
|
|
.line 335 |
|
const-string v3, "Vpai_HttpRequestManager" |
|
|
|
new-instance v4, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v5, "2IOException:" |
|
|
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v4 |
|
|
|
invoke-virtual {v1}, Ljava/io/IOException;->toString()Ljava/lang/String; |
|
|
|
move-result-object v5 |
|
|
|
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v4 |
|
|
|
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v4 |
|
|
|
invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 336 |
|
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V |
|
|
|
goto :goto_9 |
|
|
|
.line 345 |
|
:cond_7 |
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
goto/16 :goto_5 |
|
|
|
.line 331 |
|
:catchall_1 |
|
move-exception v0 |
|
|
|
move-object v4, v1 |
|
|
|
goto :goto_8 |
|
|
|
:catchall_2 |
|
move-exception v0 |
|
|
|
goto :goto_8 |
|
|
|
.line 326 |
|
:catch_5 |
|
move-exception v0 |
|
|
|
move-object v3, v1 |
|
|
|
move-object v4, v1 |
|
|
|
goto/16 :goto_6 |
|
|
|
:catch_6 |
|
move-exception v0 |
|
|
|
move-object v3, v1 |
|
|
|
goto/16 :goto_6 |
|
|
|
:catch_7 |
|
move-exception v0 |
|
|
|
goto/16 :goto_6 |
|
|
|
.line 322 |
|
:catch_8 |
|
move-exception v0 |
|
|
|
move-object v2, v1 |
|
|
|
move-object v3, v1 |
|
|
|
move-object v4, v1 |
|
|
|
goto/16 :goto_2 |
|
|
|
:catch_9 |
|
move-exception v0 |
|
|
|
move-object v3, v1 |
|
|
|
move-object v4, v1 |
|
|
|
goto/16 :goto_2 |
|
|
|
:catch_a |
|
move-exception v0 |
|
|
|
move-object v3, v1 |
|
|
|
goto/16 :goto_2 |
|
.end method |
|
|
|
.method public static instance()Lcom/viatech/util/HttpRequestManager; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 51 |
|
sget-object v0, Lcom/viatech/util/HttpRequestManager;->sIns:Lcom/viatech/util/HttpRequestManager; |
|
|
|
if-nez v0, :cond_0 |
|
|
|
.line 52 |
|
invoke-static {}, Lcom/viatech/util/HttpRequestManager;->create()V |
|
|
|
.line 54 |
|
:cond_0 |
|
sget-object v0, Lcom/viatech/util/HttpRequestManager;->sIns:Lcom/viatech/util/HttpRequestManager; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method private static trustAllHosts()V |
|
.locals 4 |
|
|
|
.prologue |
|
.line 358 |
|
const-string v0, "trustAllHosts" |
|
|
|
.line 360 |
|
const/4 v0, 0x1 |
|
|
|
new-array v0, v0, [Ljavax/net/ssl/TrustManager; |
|
|
|
const/4 v1, 0x0 |
|
|
|
new-instance v2, Lcom/viatech/util/HttpRequestManager$6; |
|
|
|
invoke-direct {v2}, Lcom/viatech/util/HttpRequestManager$6;-><init>()V |
|
|
|
aput-object v2, v0, v1 |
|
|
|
.line 379 |
|
:try_start_0 |
|
const-string v1, "TLS" |
|
|
|
invoke-static {v1}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext; |
|
|
|
move-result-object v1 |
|
|
|
.line 380 |
|
const/4 v2, 0x0 |
|
|
|
new-instance v3, Ljava/security/SecureRandom; |
|
|
|
invoke-direct {v3}, Ljava/security/SecureRandom;-><init>()V |
|
|
|
invoke-virtual {v1, v2, v0, v3}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V |
|
|
|
.line 381 |
|
invoke-virtual {v1}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory; |
|
|
|
move-result-object v0 |
|
|
|
invoke-static {v0}, Ljavax/net/ssl/HttpsURLConnection;->setDefaultSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V |
|
:try_end_0 |
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0 |
|
|
|
.line 385 |
|
:goto_0 |
|
return-void |
|
|
|
.line 382 |
|
:catch_0 |
|
move-exception v0 |
|
|
|
.line 383 |
|
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V |
|
|
|
goto :goto_0 |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method public httpGet(Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 134 |
|
new-instance v0, Lcom/viatech/util/HttpRequestManager$1; |
|
|
|
invoke-direct {v0, p0, p1, p2}, Lcom/viatech/util/HttpRequestManager$1;-><init>(Lcom/viatech/util/HttpRequestManager;Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
|
|
.line 186 |
|
iget-object v1, p0, Lcom/viatech/util/HttpRequestManager;->mWorkHandler:Landroid/os/Handler; |
|
|
|
invoke-virtual {v1, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z |
|
|
|
.line 187 |
|
return-void |
|
.end method |
|
|
|
.method public httpsGet(Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 189 |
|
new-instance v0, Lcom/viatech/util/HttpRequestManager$2; |
|
|
|
invoke-direct {v0, p0, p1, p2}, Lcom/viatech/util/HttpRequestManager$2;-><init>(Lcom/viatech/util/HttpRequestManager;Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
|
|
.line 242 |
|
iget-object v1, p0, Lcom/viatech/util/HttpRequestManager;->mWorkHandler:Landroid/os/Handler; |
|
|
|
invoke-virtual {v1, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z |
|
|
|
.line 243 |
|
return-void |
|
.end method |
|
|
|
.method public requestHttp(Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 247 |
|
iget-object v0, p0, Lcom/viatech/util/HttpRequestManager;->mWorkHandler:Landroid/os/Handler; |
|
|
|
new-instance v1, Lcom/viatech/util/HttpRequestManager$3; |
|
|
|
invoke-direct {v1, p0, p1, p2}, Lcom/viatech/util/HttpRequestManager$3;-><init>(Lcom/viatech/util/HttpRequestManager;Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
|
|
invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z |
|
|
|
.line 284 |
|
return-void |
|
.end method |
|
|
|
.method public requestHttps(Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 288 |
|
iget-object v0, p0, Lcom/viatech/util/HttpRequestManager;->mWorkHandler:Landroid/os/Handler; |
|
|
|
new-instance v1, Lcom/viatech/util/HttpRequestManager$4; |
|
|
|
invoke-direct {v1, p0, p1, p2}, Lcom/viatech/util/HttpRequestManager$4;-><init>(Lcom/viatech/util/HttpRequestManager;Ljava/lang/String;Lcom/viatech/util/HttpRequestManager$OnHttpResponseListener;)V |
|
|
|
invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z |
|
|
|
.line 296 |
|
return-void |
|
.end method
|
|
|