@Test public void batchResponseUmlautsUtf8BodyIsoHeader() throws Exception { List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>(); ODataResponse response = new ODataResponse(); response.setStatusCode(HttpStatusCode.OK.getStatusCode()); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.create(ContentType.TEXT_PLAIN, ContentType.PARAMETER_CHARSET, "UTF-8").toContentTypeString()); response.setContent(IOUtils.toInputStream("Wälter Winter" + CRLF)); parts.add(new ODataResponsePart(Collections.singletonList(response), false)); ODataResponse changeSetResponse = new ODataResponse(); changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode()); changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1"); changeSetResponse.setHeader("Custom-Header", new String("äüö".getBytes(CS_ISO_8859_1), CS_ISO_8859_1)); parts.add(new ODataResponsePart(Collections.singletonList(changeSetResponse), true)); BatchResponseSerializer serializer = new BatchResponseSerializer(); final InputStream content = serializer.serialize(parts, BOUNDARY); assertNotNull(content); final BatchLineReader reader = new BatchLineReader(content); final List<String> body = reader.toList(); reader.close(); int line = 0; assertEquals(25, body.size()); assertEquals("--" + BOUNDARY + CRLF, body.get(line++)); assertEquals("Content-Type: application/http" + CRLF, body.get(line++)); assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++)); assertEquals("Content-Type: text/plain;charset=UTF-8" + CRLF, body.get(line++)); assertEquals("Content-Length: 16" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals("Wälter Winter" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals("--" + BOUNDARY + CRLF, body.get(line++)); assertTrue(body.get(line++).startsWith("Content-Type: multipart/mixed; boundary=changeset_")); assertEquals(CRLF, body.get(line++)); assertTrue(body.get(line++).startsWith("--changeset_")); assertEquals("Content-Type: application/http" + CRLF, body.get(line++)); assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++)); assertEquals("Content-ID: 1" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++)); assertEquals("Custom-Header: äüö" + CRLF, body.get(line++)); assertEquals("Content-Length: 0" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertTrue(body.get(line++).startsWith("--changeset_")); assertEquals("--" + BOUNDARY + "--" + CRLF, body.get(line++)); }
public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); } }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  InputStream serialize(final List<ODataResponsePart> responses, final String boundary); }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  InputStream serialize(final List<ODataResponsePart> responses, final String boundary);  }