Пример #1
0
  public BatchBodyPart parse() throws BatchDeserializerException {
    headers = BatchParserCommon.consumeHeaders(remainingMessage);
    BatchParserCommon.consumeBlankLine(remainingMessage, isStrict);
    isChangeSet = isChangeSet(headers);
    requests = consumeRequest(remainingMessage);

    return this;
  }
Пример #2
0
  private List<List<Line>> splitChangeSet(List<Line> remainingMessage)
      throws BatchDeserializerException {

    final HeaderField contentTypeField = headers.getHeaderField(HttpHeader.CONTENT_TYPE);
    final String changeSetBoundary =
        BatchParserCommon.getBoundary(
            contentTypeField.getValue(), contentTypeField.getLineNumber());
    validateChangeSetBoundary(changeSetBoundary, headers);

    return BatchParserCommon.splitMessageByBoundary(remainingMessage, changeSetBoundary);
  }
Пример #3
0
 private boolean isContentTypeMultiPartMixed(final String contentType) {
   try {
     BatchParserCommon.parseContentType(contentType, ContentType.MULTIPART_MIXED, 0);
     return true;
   } catch (final BatchDeserializerException e) {
     return false;
   }
 }
  public static void validateContentType(final Header headers, final ContentType expected)
      throws BatchDeserializerException {
    final List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);

    if (contentTypes.isEmpty()) {
      throw new BatchDeserializerException(
          "Missing content type",
          MessageKeys.MISSING_CONTENT_TYPE,
          Integer.toString(headers.getLineNumber()));
    }
    BatchParserCommon.parseContentType(contentTypes.get(0), expected, headers.getLineNumber());
  }