List of utility methods to do HTTP Header
void | addCustomHeaders(HttpURLConnection conn, Map add Custom Headers for (Map.Entry<String, String> entry : headers.entrySet()) {
addHeader(conn, entry.getKey(), entry.getValue());
|
void | addHeader(HttpURLConnection conn, String headerName, String value) add Header conn.setRequestProperty(headerName, value); |
void | addHeadersToRequest(HttpURLConnection request, Map add Headers To Request if (headers != null) { for (String key : headers.keySet()) { request.addRequestProperty(key, headers.get(key)); |
void | copyHttpHeaders(@Nonnull final HttpURLConnection aConn, @Nonnull final InternetHeaders aHeaders) Copy headers from an Http connection to an InternetHeaders object for (final Map.Entry<String, List<String>> aConnHeader : aConn.getHeaderFields().entrySet()) { final String sHeaderName = aConnHeader.getKey(); if (sHeaderName != null) for (final String sHeaderValue : aConnHeader.getValue()) { if (aHeaders.getHeader(sHeaderName) == null) aHeaders.setHeader(sHeaderName, sHeaderValue); else aHeaders.addHeader(sHeaderName, sHeaderValue); ... |
HttpURLConnection | createHttpConnection(URL endpointUrl, String httpMethod, Map create Http Connection try { HttpURLConnection connection = (HttpURLConnection) endpointUrl.openConnection(); connection.setRequestMethod(httpMethod); if (headers != null) { System.out.println("--------- Request headers ---------"); for (String headerKey : headers.keySet()) { System.out.println(headerKey + ": " + headers.get(headerKey)); connection.setRequestProperty(headerKey, headers.get(headerKey)); ... |
String | delete(String url, Map Send a delete request return fetch("DELETE", url, null, headers); |
int | doDelete(URL endpoint, Map Send HttpURLConnection urlConnection = null; int responseCode; try { urlConnection = (HttpURLConnection) endpoint.openConnection(); try { urlConnection.setRequestMethod("DELETE"); } catch (ProtocolException var33) { throw new Exception( ... |
void | dumpHeaders(HttpURLConnection conn) dump Headers String name; String value; for (int i = 0; i < 20; i++) { name = conn.getHeaderFieldKey(i); value = conn.getHeaderField(i); if (name == null && value == null) break; System.out.println(name + "=" + value); ... |
void | dumpHeaders(HttpURLConnection conn, PrintStream out) dump Headers for (Map.Entry<String, List<String>> e : conn.getHeaderFields().entrySet()) for (String v : e.getValue()) out.println("received header " + e.getKey() + ": " + v); |
void | dumpHttpHeaders(HttpURLConnection conn, java.io.PrintStream out) dump Http Headers Map<String, List<String>> map = conn.getHeaderFields(); out.println("Printing All Response Header for URL: " + conn.getURL().toString() + "\n"); for (Map.Entry<String, List<String>> entry : map.entrySet()) { out.println(entry.getKey() + " : " + entry.getValue()); |