@Test public void test_isUrlEncodedForm() { String[] contentTypes = new String[] { "application/x-www-form-urlencoded", " application/x-www-form-urlencoded \r\n", "application/x-www-form-urlencoded; charset=utf-8", " application/x-www-form-urlencoded; charset=utf-8 " }; for (String contentType : contentTypes) { String message = String.format("content-type: %s", contentType); assertThat(message, urlEncodedFormHelper.isUrlEncodedForm(contentType), is(true)); } }
public boolean isUrlEncodedForm(String contentType) { if (contentType == null) { return false; } int semicolon = contentType.indexOf(';'); if (semicolon >= 0) { contentType = contentType.substring(0, semicolon).trim(); } else { contentType = contentType.trim(); } return "application/x-www-form-urlencoded".equals(contentType); }
HrrsUrlEncodedFormHelper { public boolean isUrlEncodedForm(String contentType) { if (contentType == null) { return false; } int semicolon = contentType.indexOf(';'); if (semicolon >= 0) { contentType = contentType.substring(0, semicolon).trim(); } else { contentType = contentType.trim(); } return "application/x-www-form-urlencoded".equals(contentType); } }
HrrsUrlEncodedFormHelper { public boolean isUrlEncodedForm(String contentType) { if (contentType == null) { return false; } int semicolon = contentType.indexOf(';'); if (semicolon >= 0) { contentType = contentType.substring(0, semicolon).trim(); } else { contentType = contentType.trim(); } return "application/x-www-form-urlencoded".equals(contentType); } HrrsUrlEncodedFormHelper(); }
HrrsUrlEncodedFormHelper { public boolean isUrlEncodedForm(String contentType) { if (contentType == null) { return false; } int semicolon = contentType.indexOf(';'); if (semicolon >= 0) { contentType = contentType.substring(0, semicolon).trim(); } else { contentType = contentType.trim(); } return "application/x-www-form-urlencoded".equals(contentType); } HrrsUrlEncodedFormHelper(); boolean isUrlEncodedForm(String contentType); HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding); }
HrrsUrlEncodedFormHelper { public boolean isUrlEncodedForm(String contentType) { if (contentType == null) { return false; } int semicolon = contentType.indexOf(';'); if (semicolon >= 0) { contentType = contentType.substring(0, semicolon).trim(); } else { contentType = contentType.trim(); } return "application/x-www-form-urlencoded".equals(contentType); } HrrsUrlEncodedFormHelper(); boolean isUrlEncodedForm(String contentType); HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding);  }