-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-…
- Loading branch information
Showing
23 changed files
with
414 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -393,4 +393,53 @@ public void testIE5MacBug() throws FileUploadException { | |
assertTrue(field2.isFormField()); | ||
assertEquals("fieldValue2", field2.getString()); | ||
} | ||
|
||
/** | ||
* Test for multipart/related without any content-disposition Header. | ||
* This kind of Content-Type is commonly used by SOAP-Requests with Attachments (MTOM) | ||
*/ | ||
@Test | ||
public void testMultipleRelated() throws Exception { | ||
final String soapEnvelope = | ||
"<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\r\n" + | ||
" <soap:Header></soap:Header>\r\n" + | ||
" <soap:Body>\r\n" + | ||
" <ns1:Test xmlns:ns1=\"http://www.test.org/some-test-namespace\">\r\n" + | ||
" <ns1:Attachment>\r\n" + | ||
" <xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\"" + | ||
" href=\"ref-to-attachment%40some.domain.org\"/>\r\n" + | ||
" </ns1:Attachment>\r\n" + | ||
" </ns1:Test>\r\n" + | ||
" </soap:Body>\r\n" + | ||
"</soap:Envelope>"; | ||
|
||
final String text = | ||
"-----1234\r\n" + | ||
"content-type: application/xop+xml; type=\"application/soap+xml\"\r\n" + | ||
"\r\n" + | ||
soapEnvelope + "\r\n" + | ||
"-----1234\r\n" + | ||
"Content-type: text/plain\r\n" + | ||
"content-id: <[email protected]>\r\n" + | ||
"\r\n" + | ||
"some text/plain content\r\n" + | ||
"-----1234--\r\n"; | ||
|
||
final var bytes = text.getBytes(StandardCharsets.US_ASCII); | ||
final var fileItems = parseUpload(upload, bytes, "multipart/related; boundary=---1234;" + | ||
" type=\"application/xop+xml\"; start-info=\"application/soap+xml\""); | ||
assertEquals(2, fileItems.size()); | ||
|
||
final var part1 = fileItems.get(0); | ||
assertNull(part1.getFieldName()); | ||
assertFalse(part1.isFormField()); | ||
assertEquals(soapEnvelope, part1.getString()); | ||
|
||
final var part2 = fileItems.get(1); | ||
assertNull(part2.getFieldName()); | ||
assertFalse(part2.isFormField()); | ||
assertEquals("some text/plain content", part2.getString()); | ||
assertEquals("text/plain", part2.getContentType()); | ||
assertNull(part2.getName()); | ||
} | ||
} |
Oops, something went wrong.