public void readFromConnection(HttpURLConnection connection) { Map<String, List<String>> origHeaders = connection.getHeaderFields(); headers.clear(); for (Entry<String, List<String>> entry : origHeaders.entrySet()) { if (entry.getKey() != null) { String key = HttpHeaderHelper.getHeaderKey(entry.getKey()); List<String> old = headers.get(key); if (old != null) { List<String> nl = new ArrayList<>(old.size() + entry.getValue().size()); nl.addAll(old); nl.addAll(entry.getValue()); headers.put(key, nl); } else { headers.put(key, entry.getValue()); } } } }
String mappedName = HttpHeaderHelper.getHeaderKey(fname); List<String> values = headers.get(mappedName); if (values == null) {
public static List<String> getHeader(Map<String, List<String>> headerMap, String key) { return headerMap.get(getHeaderKey(key)); }
public static List<String> getHeader(Map<String, List<String>> headerMap, String key) { return headerMap.get(getHeaderKey(key)); }
public static List<String> getHeader(Map<String, List<String>> headerMap, String key) { return headerMap.get(getHeaderKey(key)); }
public static List<String> getHeader(Map<String, List<String>> headerMap, String key) { return headerMap.get(getHeaderKey(key)); }
public static List<String> getHeader(Map<String, List<String>> headerMap, String key) { return headerMap.get(getHeaderKey(key)); }
public void readFromConnection(HttpURLConnection connection) { Map<String, List<String>> origHeaders = connection.getHeaderFields(); headers.clear(); for (String key : connection.getHeaderFields().keySet()) { if (key != null) { headers.put(HttpHeaderHelper.getHeaderKey(key), origHeaders.get(key)); } } }
public void readFromConnection(HttpURLConnection connection) { Map<String, List<String>> origHeaders = connection.getHeaderFields(); headers.clear(); for (Entry<String, List<String>> entry : origHeaders.entrySet()) { if (entry.getKey() != null) { String key = HttpHeaderHelper.getHeaderKey(entry.getKey()); List<String> old = headers.get(key); if (old != null) { List<String> nl = new ArrayList<>(old.size() + entry.getValue().size()); nl.addAll(old); nl.addAll(entry.getValue()); headers.put(key, nl); } else { headers.put(key, entry.getValue()); } } } }
public static String getAttachmentPartHeader(Attachment att) { StringBuilder buffer = new StringBuilder(200); buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": " + att.getDataHandler().getContentType() + ";\r\n"); if (att.isXOP()) { buffer.append("Content-Transfer-Encoding: binary\r\n"); } String id = att.getId(); if (id.charAt(0) == '<') { id = id.substring(1, id.length() - 1); } buffer.append("Content-ID: <" + id + ">\r\n\r\n"); return buffer.toString(); }
/** * Copy the request headers into the message. * * @param message the current message * @param headers the current set of headers */ protected void copyFromRequest(HttpServletRequest req) { //TODO how to deal with the fields for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements();) { String fname = e.nextElement(); String mappedName = HttpHeaderHelper.getHeaderKey(fname); List<String> values; if (headers.containsKey(mappedName)) { values = headers.get(mappedName); } else { values = new ArrayList<String>(); headers.put(mappedName, values); } for (Enumeration<String> e2 = req.getHeaders(fname); e2.hasMoreElements();) { String val = e2.nextElement(); values.add(val); } } if (!headers.containsKey(Message.CONTENT_TYPE)) { headers.put(Message.CONTENT_TYPE, Collections.singletonList(req.getContentType())); } if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Request Headers: " + headers.toString()); } }
public static String getAttachmentPartHeader(Attachment att) { StringBuilder buffer = new StringBuilder(200); buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": " + att.getDataHandler().getContentType() + ";\r\n"); if (att.isXOP()) { buffer.append("Content-Transfer-Encoding: binary\r\n"); } String id = att.getId(); if (id.charAt(0) == '<') { id = id.substring(1, id.length() - 1); } buffer.append("Content-ID: <" + id + ">\r\n\r\n"); return buffer.toString(); }
public static String getAttachmentPartHeader(Attachment att) { StringBuilder buffer = new StringBuilder(200); buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": " + att.getDataHandler().getContentType() + ";\r\n"); if (att.isXOP()) { buffer.append("Content-Transfer-Encoding: binary\r\n"); } String id = att.getId(); if (id.charAt(0) == '<') { id = id.substring(1, id.length() - 1); } buffer.append("Content-ID: <" + id + ">\r\n\r\n"); return buffer.toString(); }
public static String getAttachmentPartHeader(Attachment att) { StringBuilder buffer = new StringBuilder(200); buffer.append(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE) + ": " + att.getDataHandler().getContentType() + ";\r\n"); if (att.isXOP()) { buffer.append("Content-Transfer-Encoding: binary\r\n"); } String id = att.getId(); if (id.charAt(0) == '<') { id = id.substring(1, id.length() - 1); } buffer.append("Content-ID: <" + id + ">\r\n\r\n"); return buffer.toString(); }
String mappedName = HttpHeaderHelper.getHeaderKey(fname); List<String> values = headers.get(mappedName); if (values == null) {
public void handleMessage(Message message) throws Fault { Map<String, List<String>> headers = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS)); if (headers == null) { headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); message.put(Message.PROTOCOL_HEADERS, headers); } String ct = (String)message.getExchange().get(Endpoint.class).get(HttpHeaderHelper.CONTENT_TYPE); if (ct != null) { List<String> contentType = new ArrayList<String>(); contentType.add(ct); headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType); message.put(HttpHeaderHelper.CONTENT_TYPE, ct); } }