@Test(expected = BatchException.class) public void testValidateContentTransferEncodingMissingValue() throws BatchException { List<String> contentTransferEncoding = Arrays.asList(new String[] {}); final Header headers = makeHeaders(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING, contentTransferEncoding); BatchTransformatorCommon.validateContentTransferEncoding(headers, true); }
public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } }
BatchTransformatorCommon { public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } } }
BatchTransformatorCommon { public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } }  }
BatchTransformatorCommon { public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } }  static void validateContentType(final Header headers); static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest); static int getContentLength(final Header headers); static void validateHost(final Header headers, final String baseUri); }
BatchTransformatorCommon { public static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest) throws BatchException { final HeaderField contentTransferField = headers.getHeaderField(BatchHelper.HTTP_CONTENT_TRANSFER_ENCODING); if (contentTransferField != null) { final List<String> contentTransferValues = contentTransferField.getValues(); if (contentTransferValues.size() == 1) { String encoding = contentTransferValues.get(0); if (!BatchHelper.BINARY_ENCODING.equalsIgnoreCase(encoding)) { throw new BatchException( BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(contentTransferField.getLineNumber())); } } else { throw new BatchException(BatchException.INVALID_HEADER.addContent(contentTransferField.getLineNumber())); } } else { if (isChangeRequest) { throw new BatchException(BatchException.INVALID_CONTENT_TRANSFER_ENCODING.addContent(headers.getLineNumber())); } } }  static void validateContentType(final Header headers); static void validateContentTransferEncoding(final Header headers, final boolean isChangeRequest); static int getContentLength(final Header headers); static void validateHost(final Header headers, final String baseUri);  }