public class MockPart extends Object implements Part
javax.servlet.http.Part.MockHttpServletRequest.addPart(javax.servlet.http.Part),
MockMultipartFile| Constructor and Description |
|---|
MockPart(String name,
byte[] content)
Constructor for a part with byte[] content only.
|
MockPart(String name,
String filename,
byte[] content)
Constructor for a part with a filename and byte[] content.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete() |
String |
getContentType() |
String |
getHeader(String name) |
Collection<String> |
getHeaderNames() |
HttpHeaders |
getHeaders()
Return the
HttpHeaders backing header related accessor methods,
allowing for populating selected header entries. |
Collection<String> |
getHeaders(String name) |
InputStream |
getInputStream() |
String |
getName() |
long |
getSize() |
String |
getSubmittedFileName() |
void |
write(String fileName) |
public MockPart(String name, @Nullable byte[] content)
getHeaders()public MockPart(String name, @Nullable String filename, @Nullable byte[] content)
getHeaders()@Nullable public String getSubmittedFileName()
getSubmittedFileName in interface Part@Nullable public String getContentType()
getContentType in interface Partpublic InputStream getInputStream() throws IOException
getInputStream in interface PartIOExceptionpublic void write(String fileName) throws IOException
write in interface PartIOExceptionpublic void delete()
throws IOException
delete in interface PartIOExceptionpublic Collection<String> getHeaders(String name)
getHeaders in interface Partpublic Collection<String> getHeaderNames()
getHeaderNames in interface Partpublic final HttpHeaders getHeaders()
HttpHeaders backing header related accessor methods,
allowing for populating selected header entries.