/** * Handle the connection */ public void handle(URLConnection connection) throws Exception { if (matches(connection)) { if (config.connectTimeout() != 0) connection.setConnectTimeout(config.connectTimeout()); if (config.readTimeout() != 0) connection.setConnectTimeout(config.readTimeout()); for (Entry<String,String> entry : headers.entrySet()) { if (Character.isUpperCase(entry.getKey().charAt(0))) connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (connection instanceof HttpURLConnection) { HttpURLConnection http = (HttpURLConnection) connection; if (config.chunk() > 0) http.setChunkedStreamingMode(config.chunk()); http.setInstanceFollowRedirects(!config.noredirect()); } } }
/** * Handle the connection */ public void handle(URLConnection connection) throws Exception { if (matches(connection)) { if (config.connectTimeout() != 0) connection.setConnectTimeout(config.connectTimeout()); if (config.readTimeout() != 0) connection.setConnectTimeout(config.readTimeout()); for (Entry<String,String> entry : headers.entrySet()) { if (Character.isUpperCase(entry.getKey().charAt(0))) connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (connection instanceof HttpURLConnection) { HttpURLConnection http = (HttpURLConnection) connection; if (config.chunk() > 0) http.setChunkedStreamingMode(config.chunk()); http.setInstanceFollowRedirects(!config.noredirect()); } } }
/** * Handle the connection */ @Override public void handle(URLConnection connection) throws Exception { if (matches(connection)) { if (config.connectTimeout() != 0) connection.setConnectTimeout(config.connectTimeout()); if (config.readTimeout() != 0) connection.setConnectTimeout(config.readTimeout()); for (Entry<String, String> entry : headers.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (connection instanceof HttpURLConnection) { HttpURLConnection http = (HttpURLConnection) connection; if (config.chunk() > 0) http.setChunkedStreamingMode(config.chunk()); http.setInstanceFollowRedirects(!config.noredirect()); } } }
/** * Handle the connection */ @Override public void handle(URLConnection connection) throws Exception { if (matches(connection)) { if (config.connectTimeout() != 0) connection.setConnectTimeout(config.connectTimeout()); if (config.readTimeout() != 0) connection.setConnectTimeout(config.readTimeout()); for (Entry<String, String> entry : headers.entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (connection instanceof HttpURLConnection) { HttpURLConnection http = (HttpURLConnection) connection; if (config.chunk() > 0) http.setChunkedStreamingMode(config.chunk()); http.setInstanceFollowRedirects(!config.noredirect()); } } }