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