@Test public void testEquansIgnoreCase() { assertThat(HttpHeaders.equalsIgnoreCase(null, null), is(true)); assertThat(HttpHeaders.equalsIgnoreCase(null, "foo"), is(false)); assertThat(HttpHeaders.equalsIgnoreCase("bar", null), is(false)); assertThat(HttpHeaders.equalsIgnoreCase("FoO", "fOo"), is(true)); }
public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2) { if (name1 == name2) { return true; } if (name1 == null || name2 == null) { return false; } int nameLen = name1.length(); if (nameLen != name2.length()) { return false; } for (int i = nameLen - 1; i >= 0; i --) { char c1 = name1.charAt(i); char c2 = name2.charAt(i); if (c1 != c2) { if (c1 >= 'A' && c1 <= 'Z') { c1 += 32; } if (c2 >= 'A' && c2 <= 'Z') { c2 += 32; } if (c1 != c2) { return false; } } } return true; }
HttpHeaders implements Iterable<Map.Entry<String, String>> { public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2) { if (name1 == name2) { return true; } if (name1 == null || name2 == null) { return false; } int nameLen = name1.length(); if (nameLen != name2.length()) { return false; } for (int i = nameLen - 1; i >= 0; i --) { char c1 = name1.charAt(i); char c2 = name2.charAt(i); if (c1 != c2) { if (c1 >= 'A' && c1 <= 'Z') { c1 += 32; } if (c2 >= 'A' && c2 <= 'Z') { c2 += 32; } if (c1 != c2) { return false; } } } return true; } }
HttpHeaders implements Iterable<Map.Entry<String, String>> { public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2) { if (name1 == name2) { return true; } if (name1 == null || name2 == null) { return false; } int nameLen = name1.length(); if (nameLen != name2.length()) { return false; } for (int i = nameLen - 1; i >= 0; i --) { char c1 = name1.charAt(i); char c2 = name2.charAt(i); if (c1 != c2) { if (c1 >= 'A' && c1 <= 'Z') { c1 += 32; } if (c2 >= 'A' && c2 <= 'Z') { c2 += 32; } if (c1 != c2) { return false; } } } return true; } protected  HttpHeaders(); }
HttpHeaders implements Iterable<Map.Entry<String, String>> { public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2) { if (name1 == name2) { return true; } if (name1 == null || name2 == null) { return false; } int nameLen = name1.length(); if (nameLen != name2.length()) { return false; } for (int i = nameLen - 1; i >= 0; i --) { char c1 = name1.charAt(i); char c2 = name2.charAt(i); if (c1 != c2) { if (c1 >= 'A' && c1 <= 'Z') { c1 += 32; } if (c2 >= 'A' && c2 <= 'Z') { c2 += 32; } if (c1 != c2) { return false; } } } return true; } protected  HttpHeaders(); static boolean isKeepAlive(HttpMessage message); static void setKeepAlive(HttpMessage message, boolean keepAlive); static String getHeader(HttpMessage message, String name); static String getHeader(HttpMessage message, CharSequence name); static String getHeader(HttpMessage message, String name, String defaultValue); static String getHeader(HttpMessage message, CharSequence name, String defaultValue); static void setHeader(HttpMessage message, String name, Object value); static void setHeader(HttpMessage message, CharSequence name, Object value); static void setHeader(HttpMessage message, String name, Iterable<?> values); static void setHeader(HttpMessage message, CharSequence name, Iterable<?> values); static void addHeader(HttpMessage message, String name, Object value); static void addHeader(HttpMessage message, CharSequence name, Object value); static void removeHeader(HttpMessage message, String name); static void removeHeader(HttpMessage message, CharSequence name); static void clearHeaders(HttpMessage message); static int getIntHeader(HttpMessage message, String name); static int getIntHeader(HttpMessage message, CharSequence name); static int getIntHeader(HttpMessage message, String name, int defaultValue); static int getIntHeader(HttpMessage message, CharSequence name, int defaultValue); static void setIntHeader(HttpMessage message, String name, int value); static void setIntHeader(HttpMessage message, CharSequence name, int value); static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values); static void setIntHeader(HttpMessage message, CharSequence name, Iterable<Integer> values); static void addIntHeader(HttpMessage message, String name, int value); static void addIntHeader(HttpMessage message, CharSequence name, int value); static Date getDateHeader(HttpMessage message, String name); static Date getDateHeader(HttpMessage message, CharSequence name); static Date getDateHeader(HttpMessage message, String name, Date defaultValue); static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue); static void setDateHeader(HttpMessage message, String name, Date value); static void setDateHeader(HttpMessage message, CharSequence name, Date value); static void setDateHeader(HttpMessage message, String name, Iterable<Date> values); static void setDateHeader(HttpMessage message, CharSequence name, Iterable<Date> values); static void addDateHeader(HttpMessage message, String name, Date value); static void addDateHeader(HttpMessage message, CharSequence name, Date value); static long getContentLength(HttpMessage message); static long getContentLength(HttpMessage message, long defaultValue); static void setContentLength(HttpMessage message, long length); static String getHost(HttpMessage message); static String getHost(HttpMessage message, String defaultValue); static void setHost(HttpMessage message, String value); static void setHost(HttpMessage message, CharSequence value); static Date getDate(HttpMessage message); static Date getDate(HttpMessage message, Date defaultValue); static void setDate(HttpMessage message, Date value); static boolean is100ContinueExpected(HttpMessage message); static void set100ContinueExpected(HttpMessage message); static void set100ContinueExpected(HttpMessage message, boolean set); static boolean isTransferEncodingChunked(HttpMessage message); static void removeTransferEncodingChunked(HttpMessage m); static void setTransferEncodingChunked(HttpMessage m); static boolean isContentLengthSet(HttpMessage m); static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2); static boolean encodeAscii(CharSequence seq, ByteBuf buf); static CharSequence newEntity(String name); static CharSequence newNameEntity(String name); static CharSequence newValueEntity(String name); abstract String get(String name); String get(CharSequence name); abstract List<String> getAll(String name); List<String> getAll(CharSequence name); abstract List<Map.Entry<String, String>> entries(); abstract boolean contains(String name); boolean contains(CharSequence name); abstract boolean isEmpty(); abstract Set<String> names(); abstract HttpHeaders add(String name, Object value); HttpHeaders add(CharSequence name, Object value); abstract HttpHeaders add(String name, Iterable<?> values); HttpHeaders add(CharSequence name, Iterable<?> values); HttpHeaders add(HttpHeaders headers); abstract HttpHeaders set(String name, Object value); HttpHeaders set(CharSequence name, Object value); abstract HttpHeaders set(String name, Iterable<?> values); HttpHeaders set(CharSequence name, Iterable<?> values); HttpHeaders set(HttpHeaders headers); abstract HttpHeaders remove(String name); HttpHeaders remove(CharSequence name); abstract HttpHeaders clear(); boolean contains(String name, String value, boolean ignoreCaseValue); boolean contains(CharSequence name, CharSequence value, boolean ignoreCaseValue); }
HttpHeaders implements Iterable<Map.Entry<String, String>> { public static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2) { if (name1 == name2) { return true; } if (name1 == null || name2 == null) { return false; } int nameLen = name1.length(); if (nameLen != name2.length()) { return false; } for (int i = nameLen - 1; i >= 0; i --) { char c1 = name1.charAt(i); char c2 = name2.charAt(i); if (c1 != c2) { if (c1 >= 'A' && c1 <= 'Z') { c1 += 32; } if (c2 >= 'A' && c2 <= 'Z') { c2 += 32; } if (c1 != c2) { return false; } } } return true; } protected  HttpHeaders(); static boolean isKeepAlive(HttpMessage message); static void setKeepAlive(HttpMessage message, boolean keepAlive); static String getHeader(HttpMessage message, String name); static String getHeader(HttpMessage message, CharSequence name); static String getHeader(HttpMessage message, String name, String defaultValue); static String getHeader(HttpMessage message, CharSequence name, String defaultValue); static void setHeader(HttpMessage message, String name, Object value); static void setHeader(HttpMessage message, CharSequence name, Object value); static void setHeader(HttpMessage message, String name, Iterable<?> values); static void setHeader(HttpMessage message, CharSequence name, Iterable<?> values); static void addHeader(HttpMessage message, String name, Object value); static void addHeader(HttpMessage message, CharSequence name, Object value); static void removeHeader(HttpMessage message, String name); static void removeHeader(HttpMessage message, CharSequence name); static void clearHeaders(HttpMessage message); static int getIntHeader(HttpMessage message, String name); static int getIntHeader(HttpMessage message, CharSequence name); static int getIntHeader(HttpMessage message, String name, int defaultValue); static int getIntHeader(HttpMessage message, CharSequence name, int defaultValue); static void setIntHeader(HttpMessage message, String name, int value); static void setIntHeader(HttpMessage message, CharSequence name, int value); static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values); static void setIntHeader(HttpMessage message, CharSequence name, Iterable<Integer> values); static void addIntHeader(HttpMessage message, String name, int value); static void addIntHeader(HttpMessage message, CharSequence name, int value); static Date getDateHeader(HttpMessage message, String name); static Date getDateHeader(HttpMessage message, CharSequence name); static Date getDateHeader(HttpMessage message, String name, Date defaultValue); static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue); static void setDateHeader(HttpMessage message, String name, Date value); static void setDateHeader(HttpMessage message, CharSequence name, Date value); static void setDateHeader(HttpMessage message, String name, Iterable<Date> values); static void setDateHeader(HttpMessage message, CharSequence name, Iterable<Date> values); static void addDateHeader(HttpMessage message, String name, Date value); static void addDateHeader(HttpMessage message, CharSequence name, Date value); static long getContentLength(HttpMessage message); static long getContentLength(HttpMessage message, long defaultValue); static void setContentLength(HttpMessage message, long length); static String getHost(HttpMessage message); static String getHost(HttpMessage message, String defaultValue); static void setHost(HttpMessage message, String value); static void setHost(HttpMessage message, CharSequence value); static Date getDate(HttpMessage message); static Date getDate(HttpMessage message, Date defaultValue); static void setDate(HttpMessage message, Date value); static boolean is100ContinueExpected(HttpMessage message); static void set100ContinueExpected(HttpMessage message); static void set100ContinueExpected(HttpMessage message, boolean set); static boolean isTransferEncodingChunked(HttpMessage message); static void removeTransferEncodingChunked(HttpMessage m); static void setTransferEncodingChunked(HttpMessage m); static boolean isContentLengthSet(HttpMessage m); static boolean equalsIgnoreCase(CharSequence name1, CharSequence name2); static boolean encodeAscii(CharSequence seq, ByteBuf buf); static CharSequence newEntity(String name); static CharSequence newNameEntity(String name); static CharSequence newValueEntity(String name); abstract String get(String name); String get(CharSequence name); abstract List<String> getAll(String name); List<String> getAll(CharSequence name); abstract List<Map.Entry<String, String>> entries(); abstract boolean contains(String name); boolean contains(CharSequence name); abstract boolean isEmpty(); abstract Set<String> names(); abstract HttpHeaders add(String name, Object value); HttpHeaders add(CharSequence name, Object value); abstract HttpHeaders add(String name, Iterable<?> values); HttpHeaders add(CharSequence name, Iterable<?> values); HttpHeaders add(HttpHeaders headers); abstract HttpHeaders set(String name, Object value); HttpHeaders set(CharSequence name, Object value); abstract HttpHeaders set(String name, Iterable<?> values); HttpHeaders set(CharSequence name, Iterable<?> values); HttpHeaders set(HttpHeaders headers); abstract HttpHeaders remove(String name); HttpHeaders remove(CharSequence name); abstract HttpHeaders clear(); boolean contains(String name, String value, boolean ignoreCaseValue); boolean contains(CharSequence name, CharSequence value, boolean ignoreCaseValue); static final HttpHeaders EMPTY_HEADERS; }