@Test public void testLocale() throws Exception { Locale locale = getLocale(); String filename = "org/jboss/resteasy/plugins/providers/multipart/i18n/Messages.i18n_" + locale.toString() + ".properties"; if (!before(locale, filename)) { System.out.println(getClass() + ": " + filename + " not found."); return; } Assert.assertEquals( getExpected(BASE + "00", "couldFindNoContentDispositionHeader"), Messages.MESSAGES.couldFindNoContentDispositionHeader()); Assert.assertEquals( getExpected(BASE + "05", "couldNotParseContentDisposition", field), Messages.MESSAGES.couldNotParseContentDisposition(field)); Assert.assertEquals( getExpected(BASE + "20", "hadToWriteMultipartOutput", multipartOutput, writer, getClass()), Messages.MESSAGES.hadToWriteMultipartOutput(multipartOutput, writer, getClass())); Assert.assertEquals( getExpected( BASE + "35", "receivedGenericType", reader, getClass().getGenericSuperclass(), getClass()), Messages.MESSAGES.receivedGenericType( reader, getClass().getGenericSuperclass(), getClass())); Assert.assertEquals( getExpected(BASE + "60", "urlEncoderDoesNotSupportUtf8"), Messages.MESSAGES.urlEncoderDoesNotSupportUtf8()); }
@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; }