public class HttpURLConnectionService
extends java.lang.Object
InputStream & OutputStream. It is important that all
intended input and output payloads fit into memory.| Modifier and Type | Field and Description |
|---|---|
protected int |
connectTimeout |
protected int |
readTimeout |
| Constructor and Description |
|---|
HttpURLConnectionService() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
bufferStream(java.io.InputStream stream)
Utility method to extract all bytes of the
InputStream and return them as a byte array. |
protected void |
disableHttpsCertificate(javax.net.ssl.HttpsURLConnection connection) |
HttpURLConnectionResponse |
execute(HttpURLConnectionRequest request)
This method execute a request and return a response.
No exception will be thrown as the caller is responsible to check the HttpURLConnectionResponse.getIOException(). |
protected void |
logExecution(HttpURLConnectionRequest request,
HttpURLConnectionResponse response) |
void |
setConnectTimeout(int connectTimeout) |
void |
setReadTimeout(int readTimeout) |
protected void |
trace(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fields) |
public byte[] bufferStream(java.io.InputStream stream)
throws java.io.IOException
InputStream and return them as a byte array.stream - InputStream to be converted into byte[].InputStream. The length of the array equals to total number
of bytes read.java.io.IOException - May be thrown by the following 2 methods : InputStream.read() and InputStream.close()protected void disableHttpsCertificate(javax.net.ssl.HttpsURLConnection connection)
public HttpURLConnectionResponse execute(HttpURLConnectionRequest request)
HttpURLConnectionResponse.getIOException().request - HttpURLConnectionRequestHttpURLConnectionResponseprotected void logExecution(HttpURLConnectionRequest request, HttpURLConnectionResponse response)
public void setConnectTimeout(int connectTimeout)
connectTimeout - an int that specifies the connect timeout value in millisecondsURLConnection.setConnectTimeout(int)public void setReadTimeout(int readTimeout)
readTimeout - an int that specifies the timeout value to be used in millisecondsURLConnection.setReadTimeout(int)protected void trace(java.util.Map<java.lang.String,java.util.List<java.lang.String>> fields)
Copyright © 2018 SAP SE. All Rights Reserved.