@Override protected InputPart extractPart(BodyPart bodyPart) throws IOException { InputPart currPart = super.extractPart(bodyPart); Field disposition = bodyPart.getHeader().getField( FieldName.CONTENT_DISPOSITION); if (disposition == null) throw new RuntimeException(Messages.MESSAGES.couldFindNoContentDispositionHeader()); if (disposition instanceof ContentDispositionField) { String name = ((ContentDispositionField) disposition) .getParameter("name"); List<InputPart> list = formDataMap.get(name); if (list == null) { list = new LinkedList<InputPart>(); formDataMap.put(name, list); } list.add(currPart); } else { throw new RuntimeException(Messages.MESSAGES.couldNotParseContentDisposition(disposition)); } return currPart; }
@Override public void parse(InputStream is) throws IOException { super.parse(is); ContentTypeField contentTypeField = (ContentTypeField) mimeMessage .getHeader().getField(FieldName.CONTENT_TYPE); start = contentTypeField.getParameter("start"); startInfo = contentTypeField.getParameter("start-info"); type = contentTypeField.getParameter("type"); rootPart = start == null ? getParts().get(0) : relatedMap.get(start); }
@Override protected InputPart extractPart(BodyPart bodyPart) throws IOException { InputPart currPart = super.extractPart(bodyPart); Field disposition = bodyPart.getHeader().getField( FieldName.CONTENT_DISPOSITION); if (disposition == null) throw new RuntimeException(Messages.MESSAGES.couldFindNoContentDispositionHeader()); if (disposition instanceof ContentDispositionField) { String name = ((ContentDispositionField) disposition) .getParameter("name"); List<InputPart> list = formDataMap.get(name); if (list == null) { list = new LinkedList<InputPart>(); formData.put(name, currPart); formDataMap.put(name, list); } list.add(currPart); } else { throw new RuntimeException(Messages.MESSAGES.couldNotParseContentDisposition(disposition)); } return currPart; }
@Override public void parse(InputStream is) throws IOException { super.parse(is); ContentTypeField contentTypeField = (ContentTypeField) mimeMessage .getHeader().getField(FieldName.CONTENT_TYPE); start = contentTypeField.getParameter("start"); startInfo = contentTypeField.getParameter("start-info"); type = contentTypeField.getParameter("type"); rootPart = start == null ? getParts().get(0) : relatedMap.get(start); }