Effective in 2026, to align with our trunk stable development model and ensure platform stability for the ecosystem, we will publish source code to AOSP in Q2 and Q4. For building and contributing to AOSP, we recommend utilizing android-latest-release instead of aosp-main. The android-latest-release manifest branch will always reference the most recent release pushed to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
SsoClientHttpHelper
public
class
SsoClientHttpHelper
extends HttpHelper
Contains helper methods for making http requests using the sso client binary
Summary
Public methods |
HttpURLConnection
|
createConnection(URL url, String method, String contentType)
Create a to given url.
|
HttpURLConnection
|
createJsonConnection(URL url, String method)
Creates a connection to given URL for passing json data.
|
HttpURLConnection
|
createXmlConnection(URL url, String method)
Creates a connection to given URL for passing xml data.
|
String
|
doGet(String url)
Performs a GET HTTP request method for a given URL and returns it as a String.
|
void
|
doGetIgnore(String url)
Performs a GET for a given URL, with the given URL parameters ignoring the result.
|
void
|
doGetIgnoreWithRetry(String url)
Performs {doGetIgnore(String) retrying upon failure.
|
String
|
doGetWithRetry(String url)
Performs {doGet(String) retrying upon failure.
|
String
|
doPostWithRetry(String url, String postData, String contentType)
Performs a POST HTTP request method for a given URL and returns it as a String,
retrying upon failure.
|
Protected methods |
int
|
parseHttpStatusCode(String httpStatusLine)
Parse the HTTP status code (eg.
|
String
|
stripResponseHeader(String response)
Remove the header from an HTTP response from SSO client and return its body.
|
String
|
validateAndAdjustResponse(String response)
Validate and adjust a HTTP response if necessary.
|
Public constructors
SsoClientHttpHelper
public SsoClientHttpHelper ()
SsoClientHttpHelper
public SsoClientHttpHelper (String ssoClient,
String certificate)
| Parameters |
ssoClient |
String |
certificate |
String |
Public methods
createConnection
public HttpURLConnection createConnection (URL url,
String method,
String contentType)
Create a to given url.
| Parameters |
url |
URL: the URL to connect to. |
method |
String: the HTTP request method. For example, GET or POST. |
contentType |
String: the content type. For example, "text/html". |
| Returns |
HttpURLConnection |
The HttpURLConnection |
createJsonConnection
public HttpURLConnection createJsonConnection (URL url,
String method)
Creates a connection to given URL for passing json data.
| Parameters |
url |
URL: the URL to connect to. |
method |
String: the HTTP request method. For example, GET or POST. |
createXmlConnection
public HttpURLConnection createXmlConnection (URL url,
String method)
Creates a connection to given URL for passing xml data.
| Parameters |
url |
URL: the URL to connect to. |
method |
String: the HTTP request method. For example, GET or POST. |
doGet
public String doGet (String url)
Performs a GET HTTP request method for a given URL and returns it as a String.
Because remote contents are loaded into memory, this method should only be used for
relatively small data sizes.
References:
| Parameters |
url |
String: the URL |
| Returns |
String |
the String remote contents |
doGetIgnore
public void doGetIgnore (String url)
Performs a GET for a given URL, with the given URL parameters ignoring the result.
| Parameters |
url |
String: the URL |
doGetIgnoreWithRetry
public void doGetIgnoreWithRetry (String url)
Performs {doGetIgnore(String) retrying upon failure.
| Parameters |
url |
String: the URL |
doGetWithRetry
public String doGetWithRetry (String url)
Performs {doGet(String) retrying upon failure.
| Parameters |
url |
String: the URL |
| Returns |
String |
the String remote contents |
doPostWithRetry
public String doPostWithRetry (String url,
String postData,
String contentType)
Performs a POST HTTP request method for a given URL and returns it as a String,
retrying upon failure.
Because remote contents are loaded into memory, this method should only be used for
relatively small data sizes.
| Parameters |
url |
String: the URL |
postData |
String: the data to be posted once the connection is open |
contentType |
String: the content type. For example, "text/html". |
| Returns |
String |
the String remote contents |
Protected methods
parseHttpStatusCode
protected int parseHttpStatusCode (String httpStatusLine)
Parse the HTTP status code (eg. 200) from a HTTP status line (eg. HTTP/1.1 200 OK)
| Parameters |
httpStatusLine |
String |
protected String stripResponseHeader (String response)
Remove the header from an HTTP response from SSO client and return its body.
| Parameters |
response |
String |
validateAndAdjustResponse
protected String validateAndAdjustResponse (String response)
Validate and adjust a HTTP response if necessary.
| Parameters |
response |
String |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-22 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-22 UTC."],[],[]]