private static URLConnection doDelete(String url, Map<String, ?> headers, String contentType, String charset) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setRequestMethod("DELETE"); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset, boolean binary) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection, binary); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset, Map<String, ?> params) throws IOException { if (charset == null) { charset = StandardCharsets.UTF_8.name(); } URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); final Set<String> keys = params.keySet(); for (String key : keys) { Object value = params.get(key); connection.addRequestProperty(URLEncoder.encode(key, charset), URLEncoder.encode(value.toString(), charset)); } return connection; }
private static URLConnection doPost(String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setDoOutput(true); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); return connection; }
private static URLConnection doPut(String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setRequestMethod("PUT"); connection.setDoOutput(true); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); if (!(body == null || body.isEmpty())) { IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); } return connection; }
StandardCharsets.UTF_8.name(), connection); manageHeaders(headers, connection);
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset, boolean binary) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection, binary); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet( String url, Map<String, ?> headers, String contentType, String charset, boolean binary ) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); manageContentTypeHeaders( contentType, charset, connection, binary ); manageHeaders( headers, connection ); return connection; }
private static URLConnection doDelete( String url, Map<String, ?> headers, String contentType, String charset ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = ( HttpURLConnection ) new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); connection.setRequestMethod("DELETE"); manageContentTypeHeaders ( contentType, charset, connection ); manageHeaders( headers, connection ); return connection; }
private static URLConnection doDelete(String url, Map<String, ?> headers, String contentType, String charset) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setRequestMethod("DELETE"); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); return connection; }
private static URLConnection doGet( String url, Map<String, ?> headers, String contentType, String charset ) throws IOException { URLConnection connection;/* Handle output. */ connection = new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); manageContentTypeHeaders ( contentType, charset, connection ); manageHeaders( headers, connection ); return connection; }
private static URLConnection doGet( String url, Map<String, ?> headers, String contentType, String charset, Map<String, ?> params ) throws IOException { if (charset==null) { charset = StandardCharsets.UTF_8.name (); } URLConnection connection;/* Handle output. */ connection = new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); manageContentTypeHeaders( contentType, charset, connection ); manageHeaders( headers, connection ); final Set<String> keys = params.keySet(); for ( String key : keys ) { Object value = params.get( key ); connection.addRequestProperty ( URLEncoder.encode(key, charset), URLEncoder.encode ( value.toString(), charset) ); } return connection; }
private static URLConnection doPost(String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setDoOutput(true); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); return connection; }
private static URLConnection doPost( String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = ( HttpURLConnection ) new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); connection.setDoOutput( true ); manageContentTypeHeaders( contentType, charset, connection ); manageHeaders( headers, connection ); IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); return connection; }
private static URLConnection doPut(String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); connection.setRequestMethod("PUT"); connection.setDoOutput(true); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); if (!(body == null || body.isEmpty())) { IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); } return connection; }
private static URLConnection doPut( String url, Map<String, ?> headers, String contentType, String charset, String body ) throws IOException { HttpURLConnection connection;/* Handle output. */ connection = ( HttpURLConnection ) new URL( url ).openConnection(); connection.setConnectTimeout( DEFAULT_TIMEOUT_SECONDS * 1000 ); connection.setRequestMethod("PUT"); connection.setDoOutput( true ); manageContentTypeHeaders( contentType, charset, connection ); manageHeaders( headers, connection ); IO.write(connection.getOutputStream(), body, IO.DEFAULT_CHARSET); return connection; }
private static URLConnection doGet(String url, Map<String, ?> headers, String contentType, String charset, Map<String, ?> params) throws IOException { if (charset == null) { charset = StandardCharsets.UTF_8.name(); } URLConnection connection;/* Handle output. */ connection = new URL(url).openConnection(); connection.setConnectTimeout(DEFAULT_TIMEOUT_SECONDS * 1000); manageContentTypeHeaders(contentType, charset, connection); manageHeaders(headers, connection); final Set<String> keys = params.keySet(); for (String key : keys) { Object value = params.get(key); connection.addRequestProperty(URLEncoder.encode(key, charset), URLEncoder.encode(value.toString(), charset)); } return connection; }
StandardCharsets.UTF_8.name(), connection ); manageHeaders( headers, connection );