private void setHeaders(HttpRequest httprequest, HttpURLConnection httpurlconnection) { if (logger.isDebugEnabled()) { logger.debug("Request: "); logger.debug((new StringBuilder()).append(httprequest.getMethod().name()).append(" ").toString(), httprequest.getURL()); } if (httprequest.getAuthorization() != null) { String s = httprequest.getAuthorization().getAuthorizationHeader(httprequest); if (s != null) { if (logger.isDebugEnabled()) { logger.debug("Authorization: ", z_T4JInternalStringUtil.maskString(s)); } httpurlconnection.addRequestProperty("Authorization", s); } } if (httprequest.getRequestHeaders() != null) { String s1; for (Iterator iterator = httprequest.getRequestHeaders().keySet().iterator(); iterator.hasNext(); logger.debug((new StringBuilder()).append(s1).append(": ").append((String)httprequest.getRequestHeaders().get(s1)).toString())) { s1 = (String)iterator.next(); httpurlconnection.addRequestProperty(s1, (String)httprequest.getRequestHeaders().get(s1)); } } }
protected HttpURLConnection getConnection(String s) { if (isProxyConfigured()) { if (CONF.getHttpProxyUser() != null && !CONF.getHttpProxyUser().equals("")) { if (logger.isDebugEnabled()) { logger.debug((new StringBuilder("Proxy AuthUser: "******"Proxy AuthPassword: "******"Opening proxied connection(")).append(CONF.getHttpProxyHost()).append(":").append(CONF.getHttpProxyPort()).append(")").toString()); } s = (HttpURLConnection)(new URL(s)).openConnection(proxy); } else { s = (HttpURLConnection)(new URL(s)).openConnection(); } if (CONF.getHttpConnectionTimeout() > 0) { s.setConnectTimeout(CONF.getHttpConnectionTimeout()); } if (CONF.getHttpReadTimeout() > 0) { s.setReadTimeout(CONF.getHttpReadTimeout()); } s.setInstanceFollowRedirects(false); return s; }