URLConnection urlCon = url.openConnection();
// If this is an HTTP connection attach any request properties to the request.
if (urlCon instanceof HttpURLConnection && source instanceof HTTPInputSource) {
final HttpURLConnection urlConnection = (HttpURLConnection) urlCon;
final HTTPInputSource httpInputSource = (HTTPInputSource) source;
// set request properties
Iterator propIter = httpInputSource.getHTTPRequestProperties();
while (propIter.hasNext()) {
Map.Entry entry = (Map.Entry) propIter.next();
urlConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
}
// set preference for redirection
boolean followRedirects = httpInputSource.getFollowHTTPRedirects();
if (!followRedirects) {
XMLEntityManager.setInstanceFollowRedirects(urlConnection, followRedirects);
}
}