public class HttpResponseConnector extends Object
| Constructor and Description |
|---|
HttpResponseConnector()
Default constructor to retrieve response as a string
|
HttpResponseConnector(HttpRequestConnector.ResponseOption responseOption)
Constructor to set specific response option
(String, write to file, byte array)
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getByteArray() |
String |
getContentType() |
Map<String,List<String>> |
getHeaders() |
String |
getOutputFilePath() |
String |
getResponse() |
int |
getStatusCode() |
String |
getStatusMessage() |
String |
headerFirstValue(String name)
Return first header string value of the given named header.
|
void |
processResponse(okhttp3.Response httpResponse)
Process the HTTP response
|
void |
processResponse(okhttp3.Response httpResponse,
String outputFilePath)
Process the HTTP response and optionally write to a file
|
public HttpResponseConnector()
public HttpResponseConnector(HttpRequestConnector.ResponseOption responseOption)
responseOption - Option for processing the responsepublic void processResponse(okhttp3.Response httpResponse)
httpResponse - The HTTP response from the requestpublic void processResponse(okhttp3.Response httpResponse,
String outputFilePath)
httpResponse - The HTTP response from the requestoutputFilePath - Destination for writing filespublic Map<String,List<String>> getHeaders()
public String headerFirstValue(String name)
name - The header name (key) to retrievepublic int getStatusCode()
public String getStatusMessage()
public String getContentType()
public String getResponse()
public byte[] getByteArray()
public String getOutputFilePath()
Copyright © 2021. All rights reserved.