@Test public void testIsEncoded () throws Exception { final StringEntity entity = new StringEntity("...", null); entity.setContentType(URLEncodedUtils.CONTENT_TYPE); Assert.assertTrue(URLEncodedUtils.isEncoded(entity)); entity.setContentType(URLEncodedUtils.CONTENT_TYPE + "; charset=US-ASCII"); Assert.assertTrue(URLEncodedUtils.isEncoded(entity)); entity.setContentType("text/test"); Assert.assertFalse(URLEncodedUtils.isEncoded(entity)); }
public static boolean isEncoded (final HttpEntity entity) { Header h = entity.getContentType(); if (h != null) { HeaderElement[] elems = h.getElements(); if (elems.length > 0) { String contentType = elems[0].getName(); return contentType.equalsIgnoreCase(CONTENT_TYPE); } else { return false; } } else { return false; } }
URLEncodedUtils { public static boolean isEncoded (final HttpEntity entity) { Header h = entity.getContentType(); if (h != null) { HeaderElement[] elems = h.getElements(); if (elems.length > 0) { String contentType = elems[0].getName(); return contentType.equalsIgnoreCase(CONTENT_TYPE); } else { return false; } } else { return false; } } }
URLEncodedUtils { public static boolean isEncoded (final HttpEntity entity) { Header h = entity.getContentType(); if (h != null) { HeaderElement[] elems = h.getElements(); if (elems.length > 0) { String contentType = elems[0].getName(); return contentType.equalsIgnoreCase(CONTENT_TYPE); } else { return false; } } else { return false; } }  }
URLEncodedUtils { public static boolean isEncoded (final HttpEntity entity) { Header h = entity.getContentType(); if (h != null) { HeaderElement[] elems = h.getElements(); if (elems.length > 0) { String contentType = elems[0].getName(); return contentType.equalsIgnoreCase(CONTENT_TYPE); } else { return false; } } else { return false; } }  static List <NameValuePair> parse(final URI uri, final String encoding); static List <NameValuePair> parse(
            final HttpEntity entity); static boolean isEncoded(final HttpEntity entity); static void parse(
            final List <NameValuePair> parameters,
            final Scanner scanner,
            final String encoding); static String format(
            final List <? extends NameValuePair> parameters,
            final String encoding); }
URLEncodedUtils { public static boolean isEncoded (final HttpEntity entity) { Header h = entity.getContentType(); if (h != null) { HeaderElement[] elems = h.getElements(); if (elems.length > 0) { String contentType = elems[0].getName(); return contentType.equalsIgnoreCase(CONTENT_TYPE); } else { return false; } } else { return false; } }  static List <NameValuePair> parse(final URI uri, final String encoding); static List <NameValuePair> parse(
            final HttpEntity entity); static boolean isEncoded(final HttpEntity entity); static void parse(
            final List <NameValuePair> parameters,
            final Scanner scanner,
            final String encoding); static String format(
            final List <? extends NameValuePair> parameters,
            final String encoding); static final String CONTENT_TYPE; }