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.
|
java.lang.String |
getContentType()
Obtain the content type passed by the browser.
|
java.lang.String |
getHeader(java.lang.String name)
Obtains the value of the specified part header as a String.
|
java.util.Collection<java.lang.String> |
getHeaderNames()
Get the header names provided for this part.
|
java.util.Collection<java.lang.String> |
getHeaders(java.lang.String name)
Obtain all the values of the specified part header.
|
java.io.InputStream |
getInputStream()
Obtain an
InputStream that can be used to retrieve the
contents of the file. |
java.lang.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(java.lang.String fileName)
A convenience method to write an uploaded part to disk.
|
java.io.InputStream getInputStream() throws java.io.IOException
InputStream
that can be used to retrieve the
contents of the file.java.io.IOException
- if an I/O occurs while obtaining the streamjava.lang.String getContentType()
null
if
not defined.java.lang.String getName()
long getSize()
void write(java.lang.String fileName) throws java.io.IOException
fileName
- The location into which the uploaded part should be
stored. Relative locations are relative to MultipartConfigElement.getLocation()
java.io.IOException
- if an I/O occurs while attempting to write the partvoid delete() throws java.io.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.
java.io.IOException
- if an I/O occurs while attempting to delete the partjava.lang.String getHeader(java.lang.String name)
name
- Header namenull
if the header is not
presentjava.util.Collection<java.lang.String> getHeaders(java.lang.String name)
name
- The name of the header of interest. The header name is case
insensitive.java.util.Collection<java.lang.String> getHeaderNames()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.