public interface Part
multipart/form-data
request body. The part may represent either
an uploaded file or form data.Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes the underlying storage for a part, including deleting any
associated temporary disk file.
|
String |
getContentType()
Obtain the content type passed by the browser.
|
String |
getHeader(String name)
Obtains the value of the specified part header as a String.
|
Collection<String> |
getHeaderNames()
Get the header names provided for this part.
|
Collection<String> |
getHeaders(String name)
Obtain all the values of the specified part header.
|
InputStream |
getInputStream()
Obtain an
InputStream that can be used to retrieve the
contents of the file. |
String |
getName()
Obtain the name of the field in the multipart form corresponding to this
part.
|
long |
getSize()
Obtain the size of this part.
|
void |
write(String fileName)
A convenience method to write an uploaded part to disk.
|
InputStream getInputStream() throws IOException
InputStream
that can be used to retrieve the
contents of the file.IOException
- if an I/O occurs while obtaining the streamString getContentType()
null
if
not defined.String getName()
long getSize()
void write(String fileName) throws IOException
fileName
- The location into which the uploaded part should be
stored. Relative locations are relative to MultipartConfigElement.getLocation()
IOException
- if an I/O occurs while attempting to write the partvoid delete() throws IOException
Containers are only required to delete the associated storage when the Part instance is garbage collected. Apache Tomcat will delete the associated storage when the associated request has finished processing. Behaviour of other containers may be different.
IOException
- if an I/O occurs while attempting to delete the partString getHeader(String name)
name
- Header namenull
if the header is not
presentCollection<String> getHeaders(String name)
name
- The name of the header of interest. The header name is case
insensitive.Collection<String> getHeaderNames()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.