SsoClientHttpHelper

public class SsoClientHttpHelper
extends HttpHelper

java.lang.Object
   ↳ com.android.tradefed.util.net.HttpHelper
     ↳ com.google.android.tradefed.build.SsoClientHttpHelper


sso クライアント バイナリを使用して http リクエストを行うためのヘルパー メソッドが含まれています

概要

パブリック コンストラクタ

SsoClientHttpHelper()
SsoClientHttpHelper(String ssoClient, String certificate)

パブリック メソッド

HttpURLConnection createConnection(URL url, String method, String contentType)

指定された URL に作成します。

HttpURLConnection createJsonConnection(URL url, String method)

JSON データを渡すために、指定された URL への接続を作成します。

HttpURLConnection createXmlConnection(URL url, String method)

XML データを渡すために、指定された URL への接続を作成します。

String doGet(String url)

指定された URL に対して GET HTTP リクエスト メソッドを実行し、String として返します。

void doGetIgnore(String url)

指定された URL パラメータを使用して、指定された URL の GET を実行し、結果を無視します。

void doGetIgnoreWithRetry(String url)

失敗時に {doGetIgnore(String) 再試行を実行します。

String doGetWithRetry(String url)

失敗時に {doGet(String) 再試行を実行します。

String doPostWithRetry(String url, String postData, String contentType)

指定された URL に対して POST HTTP リクエスト メソッドを実行し、String として返します。失敗した場合は再試行します。

保護されたメソッド

int parseHttpStatusCode(String httpStatusLine)

HTTP ステータス コードを解析します(例:

String stripResponseHeader(String response)

SSO クライアントからの HTTP レスポンスからヘッダーを削除し、その本文を返します。

String validateAndAdjustResponse(String response)

必要に応じて HTTP レスポンスを検証して調整します。

パブリック コンストラクタ

SsoClientHttpHelper

public SsoClientHttpHelper ()

SsoClientHttpHelper

public SsoClientHttpHelper (String ssoClient, 
                String certificate)

パラメータ
ssoClient String

certificate String

パブリック メソッド

createConnection

public HttpURLConnection createConnection (URL url, 
                String method, 
                String contentType)

指定された URL に作成します。

パラメータ
url URL: 接続先の URL

method String: HTTP リクエスト メソッド。たとえば、GET や POST などです。

contentType String: コンテンツ タイプ。例: 「text/html」。

戻り値
HttpURLConnection HttpURLConnection

例外
IOException

createJsonConnection

public HttpURLConnection createJsonConnection (URL url, 
                String method)

JSON データを渡すために、指定された URL への接続を作成します。

パラメータ
url URL: 接続先の URL

method String: HTTP リクエスト メソッド。たとえば、GET や POST などです。

戻り値
HttpURLConnection HttpURLConnection

例外
IOException

createXmlConnection

public HttpURLConnection createXmlConnection (URL url, 
                String method)

XML データを渡すために、指定された URL への接続を作成します。

パラメータ
url URL: 接続先の URL

method String: HTTP リクエスト メソッド。たとえば、GET や POST などです。

戻り値
HttpURLConnection HttpURLConnection

例外
IOException

doGet

public String doGet (String url)

指定された URL に対して GET HTTP リクエスト メソッドを実行し、String として返します。

リモート コンテンツはメモリに読み込まれるため、このメソッドは比較的小さなデータサイズにのみ使用してください。

リファレンス:

パラメータ
url String: URL

戻り値
String String 個のリモート コンテンツ

例外
IHttpHelper.DataSizeException
IOException

doGetIgnore

public void doGetIgnore (String url)

指定された URL パラメータを使用して、指定された URL の GET を実行し、結果を無視します。

パラメータ
url String: URL

例外
IOException

doGetIgnoreWithRetry

public void doGetIgnoreWithRetry (String url)

失敗時に doGetIgnore(String) の再試行を行います。

パラメータ
url String: URL

例外
IOException

doGetWithRetry

public String doGetWithRetry (String url)

失敗時に doGet(String) の再試行を行います。

パラメータ
url String: URL

戻り値
String String 個のリモート コンテンツ

例外
IHttpHelper.DataSizeException
IOException

doPostWithRetry

public String doPostWithRetry (String url, 
                String postData, 
                String contentType)

指定された URL に対して POST HTTP リクエスト メソッドを実行し、String として返します。失敗した場合は再試行します。

リモート コンテンツはメモリに読み込まれるため、このメソッドは比較的小さなデータサイズにのみ使用してください。

パラメータ
url String: URL

postData String: 接続が開いた後に投稿されるデータ

contentType String: コンテンツ タイプ。例: 「text/html」。

戻り値
String String 個のリモート コンテンツ

例外
IHttpHelper.DataSizeException
IOException

保護されたメソッド

parseHttpStatusCode

protected int parseHttpStatusCode (String httpStatusLine)

HTTP ステータス コード(例: 200)を HTTP ステータス行(例: HTTP/1.1 200 OK)

パラメータ
httpStatusLine String

戻り値
int

関連項目:

stripResponseHeader

protected String stripResponseHeader (String response)

SSO クライアントからの HTTP レスポンスからヘッダーを削除し、その本文を返します。

パラメータ
response String

戻り値
String

validateAndAdjustResponse

protected String validateAndAdjustResponse (String response)

必要に応じて HTTP レスポンスを検証して調整します。

パラメータ
response String

戻り値
String