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/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