public final class UtilsHTTP
extends java.lang.Object
Utilities class relating to connections and HTTP/S protocol.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HEADER_ACCEPT_ENCODING
Constant attribute that represents the "Accept-Encoding" header.
|
static java.lang.String |
HEADER_USER_AGENT
Constant attribute that represents the "User-Agent" header.
|
static java.lang.String |
HTTP_HEADER_USER_AGENT_HTTPCLIENT
Constant attribute that represents the Apache-HttpClient User-Agent Header.
|
static java.lang.String |
HTTP_HEADER_USER_AGENT_JAKARTA
Constant attribute that represents the Jakarta Commons-HttpClient User-Agent Header.
|
static java.lang.String |
HTTP_SCHEME
Constant attribute that represents the representation string of the scheme http.
|
static java.lang.String |
HTTPS_SCHEME
Constant attribute that represents the representation string of the scheme https.
|
static java.lang.String |
OUTPUT_CONTENT_TYPE_OCSP_RESPONSE
Constant attribute that represents the value of the output 'Content-type' for http request by post.
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getDataFromURI(java.lang.String path,
int connectionTimeout,
int readTimeout)
Method that allows download the data from a URI using the
HttpClient library. |
static byte[] |
getDataFromURI(java.lang.String uriString,
int connectionTimeout,
int readTimeout,
java.lang.String user,
java.lang.String password,
java.util.Map<java.lang.String,java.lang.String> headersMap)
Method that allows download the data from a URI using the
HttpClient library. |
static byte[] |
getResponseByHttpPostWithEntity(java.lang.String uriString,
int connectionTimeout,
int readTimeout,
byte[] inputData,
java.lang.String inputContentType,
java.lang.String outputContentType,
java.lang.String user,
java.lang.String password)
Method that makes a HTTP POST request to certain URL and obtains the response as a bytes array.
|
static boolean |
isUriOfSchemeHTTP(java.lang.String uriString,
int checkMode)
This method determines whether a given URI scheme is HTTP or HTTPS.
|
static boolean |
isUriOfSchemeHTTP(java.net.URI uri,
int checkMode)
This method determines whether a given URI scheme is HTTP or HTTPS.
|
public static final java.lang.String HTTP_SCHEME
public static final java.lang.String HTTPS_SCHEME
public static final java.lang.String HTTP_HEADER_USER_AGENT_HTTPCLIENT
public static final java.lang.String HTTP_HEADER_USER_AGENT_JAKARTA
public static final java.lang.String OUTPUT_CONTENT_TYPE_OCSP_RESPONSE
public static final java.lang.String HEADER_USER_AGENT
public static final java.lang.String HEADER_ACCEPT_ENCODING
public static boolean isUriOfSchemeHTTP(java.lang.String uriString,
int checkMode)
uriString - String representation of the URI to analyze.checkMode - Int that determines the check mode operation:
public static boolean isUriOfSchemeHTTP(java.net.URI uri,
int checkMode)
uri - Representation of the URI to analyze.checkMode - Int that determines the check mode operation:
public static byte[] getResponseByHttpPostWithEntity(java.lang.String uriString,
int connectionTimeout,
int readTimeout,
byte[] inputData,
java.lang.String inputContentType,
java.lang.String outputContentType,
java.lang.String user,
java.lang.String password)
throws CommonUtilsException
RequestEntity using the HttpClient library provided by Jakarta.uriString - Parameter that represents the connection path to the resource.connectionTimeout - Parameter that represents the timeout for the connection.readTimeout - Parameter that represents the timeout for the data reading.inputData - Parameter that represents the data to insert inside the RequestEntity.inputContentType - Parameter that represents the content-type of the request.outputContentType - Parameter that represents the content-type of the response.user - Parameter that represents the user for authentication.password - Parameter that represents the password for authentication.CommonUtilsException - If there is some error with the input parameters or the connection.public static byte[] getDataFromURI(java.lang.String uriString,
int connectionTimeout,
int readTimeout,
java.lang.String user,
java.lang.String password,
java.util.Map<java.lang.String,java.lang.String> headersMap)
throws CommonUtilsException
HttpClient library.uriString - Parameter that represents the connection path (URI) to the resource.connectionTimeout - Parameter that represents the timeout for the connection.readTimeout - Parameter that represents the timeout for the data reading.user - Parameter that represents the user for authentication.password - Parameter that represents the password for authentication.headersMap - Parameter that represents a list of specific headers for the HTTP/S connection.CommonUtilsException - In case of some error getting the resource.public static byte[] getDataFromURI(java.lang.String path,
int connectionTimeout,
int readTimeout)
throws CommonUtilsException
HttpClient library.path - Parameter that represents the connection path (URI) to the resource.connectionTimeout - Parameter that represents the timeout for the connection.readTimeout - Parameter that represents the timeout for the data reading.CommonUtilsException - In case of some error getting the resource.