/** Returns the value of all headers with the specified name, or the empty list. * <p><em>NOTE:</em> on the iOS backend, repeated headers will be coalesced into a single * header separated by commas. This sucks but we can't "undo" the coalescing without breaking * otherwise normal headers that happent to contain commas. Complain to Apple.</p> */ public List<String> headers(String name) { List<String> values = headers().get(name); return values == null ? Collections.<String>emptyList() : values; }
/** Returns the value of the header with the specified name, or null. If there are multiple * response headers with this name, one will be chosen using an undefined algorithm. */ public String header(String name) { List<String> values = headers().get(name); return (values == null) ? null : values.get(0); }
/** Returns the value of all headers with the specified name, or the empty list. * <p><em>NOTE:</em> on the iOS backend, repeated headers will be coalesced into a single * header separated by commas. This sucks but we can't "undo" the coalescing without breaking * otherwise normal headers that happent to contain commas. Complain to Apple.</p> */ public List<String> headers(String name) { List<String> values = headers().get(name); return values == null ? Collections.<String>emptyList() : values; }
protected void displayResult (Net.Response rsp) { StringBuilder buf = new StringBuilder(); buf.append("Response code: ").append(rsp.responseCode()); buf.append("\n\nHeaders:\n"); for (String header : rsp.headerNames()) { buf.append(header).append(":"); int vv = 0; for (String value : rsp.headers(header)) { if (vv++ > 0) buf.append(","); buf.append(" ").append(value); } buf.append("\n"); } buf.append("\nBody:\n"); String payload = rsp.payloadString(); if (payload.length() > 1024) payload = payload.substring(0, 1024) + "..."; buf.append(payload); displayText(buf.toString()); }
protected void displayResult (Net.Response rsp) { StringBuilder buf = new StringBuilder(); buf.append("Response code: ").append(rsp.responseCode()); buf.append("\n\nHeaders:\n"); for (String header : rsp.headerNames()) { buf.append(header).append(":"); int vv = 0; for (String value : rsp.headers(header)) { if (vv++ > 0) buf.append(","); buf.append(" ").append(value); } buf.append("\n"); } buf.append("\nBody:\n"); String payload = rsp.payloadString(); if (payload.length() > 1024) payload = payload.substring(0, 1024) + "..."; buf.append(payload); displayText(buf.toString()); }
/** Returns the names of all headers returned by the server. */ public Iterable<String> headerNames() { return headers().keySet(); }
/** Returns the names of all headers returned by the server. */ public Iterable<String> headerNames() { return headers().keySet(); }
/** Returns the value of the header with the specified name, or null. If there are multiple * response headers with this name, one will be chosen using an undefined algorithm. */ public String header(String name) { List<String> values = headers().get(name); return (values == null) ? null : values.get(0); }