@Test public void test_extractUrlEncodedFormPayload() { HttpServletRequest request = mock(HttpServletRequest.class); String encoding = "ASCII"; when(request.getCharacterEncoding()).thenReturn(encoding); when(request.getQueryString()).thenReturn("y=y1"); when(request.getParameterNames()).thenReturn(Collections.enumeration(Arrays.asList("x", "y"))); when(request.getParameterValues("x")).thenReturn(new String[] {"x1", "x2"}); when(request.getParameterValues("y")).thenReturn(new String[] {"y2"}); HttpRequestPayload payload = urlEncodedFormHelper.extractUrlEncodedFormPayload(request, null); assertThat(payload.getMissingByteCount(), is(0)); assertThat(new String(payload.getBytes(), Charset.forName(encoding)), is(equalTo("x=x1&x=x2&y=y2"))); }
public HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding) { byte[] encodedFormParameterBytes = encodeFormParameters(request, defaultEncoding); return ImmutableHttpRequestPayload .newBuilder() .setMissingByteCount(0) .setBytes(encodedFormParameterBytes) .build(); }
HrrsUrlEncodedFormHelper { public HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding) { byte[] encodedFormParameterBytes = encodeFormParameters(request, defaultEncoding); return ImmutableHttpRequestPayload .newBuilder() .setMissingByteCount(0) .setBytes(encodedFormParameterBytes) .build(); } }
HrrsUrlEncodedFormHelper { public HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding) { byte[] encodedFormParameterBytes = encodeFormParameters(request, defaultEncoding); return ImmutableHttpRequestPayload .newBuilder() .setMissingByteCount(0) .setBytes(encodedFormParameterBytes) .build(); } HrrsUrlEncodedFormHelper(); }
HrrsUrlEncodedFormHelper { public HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding) { byte[] encodedFormParameterBytes = encodeFormParameters(request, defaultEncoding); return ImmutableHttpRequestPayload .newBuilder() .setMissingByteCount(0) .setBytes(encodedFormParameterBytes) .build(); } HrrsUrlEncodedFormHelper(); boolean isUrlEncodedForm(String contentType); HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding); }
HrrsUrlEncodedFormHelper { public HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding) { byte[] encodedFormParameterBytes = encodeFormParameters(request, defaultEncoding); return ImmutableHttpRequestPayload .newBuilder() .setMissingByteCount(0) .setBytes(encodedFormParameterBytes) .build(); } HrrsUrlEncodedFormHelper(); boolean isUrlEncodedForm(String contentType); HttpRequestPayload extractUrlEncodedFormPayload(HttpServletRequest request, String defaultEncoding);  }