connection.setInstanceFollowRedirects(false);
connection.setUseCaches(false);
if (connection instanceof HttpsURLConnection
&& hostnameVerifier != null) {
HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
httpsConnection.setHostnameVerifier(hostnameVerifier);
}
// Set the request headers
if (result != null) {
connection.setRequestProperty("Content-Type", serializerLocal.getMIMEType(result));