public class JavaHttpProvider extends Object implements HttpProvider
HttpURLConnection.| Modifier and Type | Class and Description |
|---|---|
static class |
JavaHttpProvider.Builder |
HttpProvider.HttpRequest, HttpProvider.HttpRequestAuthorizer, HttpProvider.HttpResponse| Modifier and Type | Method and Description |
|---|---|
static JavaHttpProvider.Builder |
builder() |
void |
close() |
HttpProvider.HttpResponse |
execute(HttpProvider.HttpRequest httpRequest)
Execute the httpRequest.
|
protected long |
getContentLength(HttpURLConnection connection) |
protected static byte[] |
getFormBody(Map<String,List<String>> formParams) |
protected HttpURLConnection |
getHttpUrlConnection(String urlString) |
HttpProvider.HttpRequest |
getRequest(HttpProvider.HttpRequestAuthorizer httpRequestAuthorizer,
String method,
String url,
Map<String,List<String>> formParams)
Gets the RequestBuilder, with the specified method, url, and formParams.
|
HttpProvider.HttpRequest |
getRequest(HttpProvider.HttpRequestAuthorizer httpRequestAuthorizer,
String method,
String url,
String requestBodyJson)
Gets the RequestBuilder, with the specified method, url, and requestBodyJson.
|
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic HttpProvider.HttpRequest getRequest(HttpProvider.HttpRequestAuthorizer httpRequestAuthorizer, String method, String url, String requestBodyJson)
HttpProvidergetRequest in interface HttpProviderhttpRequestAuthorizer - for adding the Authorization header valuemethod - HTTP method valueurl - HTTP request URLrequestBodyJson - the
Content-Type: application/json
JSON request body.HttpProvider.execute(HttpRequest).public HttpProvider.HttpRequest getRequest(HttpProvider.HttpRequestAuthorizer httpRequestAuthorizer, String method, String url, Map<String,List<String>> formParams)
HttpProvidergetRequest in interface HttpProviderhttpRequestAuthorizer - for adding the Authorization header valuemethod - HTTP method valueurl - HTTP request URLformParams - the
Content-Type: application/x-www-form-urlencoded
form parameters.HttpProvider.execute(HttpRequest).protected long getContentLength(HttpURLConnection connection)
protected HttpURLConnection getHttpUrlConnection(String urlString) throws IOException
IOExceptionpublic HttpProvider.HttpResponse execute(HttpProvider.HttpRequest httpRequest) throws HttpException, IOException
HttpProviderexecute in interface HttpProviderhttpRequest - the HttpRequestHttpException - if there is trouble executing the httpRequestIOException - if there is I/O trouble executing the httpRequestprotected static byte[] getFormBody(Map<String,List<String>> formParams) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static JavaHttpProvider.Builder builder()
Copyright © 2021 HERE Europe B.V. All Rights Reserved.