private void writeOutBoundHeaders(MultivaluedMap<String, Object> metadata, HttpURLConnection uc) { for (Map.Entry<String, List<Object>> e : metadata.entrySet()) { List<Object> vs = e.getValue(); if (vs.size() == 1) { uc.setRequestProperty(e.getKey(), ClientRequest.getHeaderValue(vs.get(0))); } else { StringBuilder b = new StringBuilder(); boolean add = false; for (Object v : e.getValue()) { if (add) b.append(','); add = true; b.append(ClientRequest.getHeaderValue(v)); } uc.setRequestProperty(e.getKey(), b.toString()); } } }
private void writeOutBoundHeaders(MultivaluedMap<String, Object> headers, Request request) { for (Map.Entry<String, List<Object>> e : headers.entrySet()) { final List<Object> vs = e.getValue(); if (vs.size() == 1) { request.header(e.getKey(), ClientRequest.getHeaderValue(vs.get(0))); } else { final StringBuilder header = new StringBuilder(); for (Object v : e.getValue()) { if (header.length() > 0) { header.append(','); } header.append(ClientRequest.getHeaderValue(v)); } request.header(e.getKey(), header.toString()); } } }