| Constructor and Description |
|---|
ApplicationPart(FileItem fileItem,
java.io.File location) |
| 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.
|
java.lang.String |
getString(java.lang.String encoding) |
java.lang.String |
getSubmittedFileName()
If this part represents an uploaded file, gets the file name submitted
in the upload.
|
void |
write(java.lang.String fileName)
A convenience method to write an uploaded part to disk.
|
public ApplicationPart(FileItem fileItem, java.io.File location)
public void delete()
throws java.io.IOException
javax.servlet.http.PartContainers 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.
public java.lang.String getContentType()
javax.servlet.http.PartgetContentType in interface Partnull if
not defined.public java.lang.String getHeader(java.lang.String name)
javax.servlet.http.Partpublic java.util.Collection<java.lang.String> getHeaderNames()
javax.servlet.http.PartgetHeaderNames in interface Partpublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
javax.servlet.http.PartgetHeaders in interface Partname - The name of the header of interest. The header name is case
insensitive.public java.io.InputStream getInputStream()
throws java.io.IOException
javax.servlet.http.PartInputStream that can be used to retrieve the
contents of the file.getInputStream in interface Partjava.io.IOException - if an I/O occurs while obtaining the streampublic java.lang.String getName()
javax.servlet.http.Partpublic long getSize()
javax.servlet.http.Partpublic void write(java.lang.String fileName)
throws java.io.IOException
javax.servlet.http.Partwrite in interface PartfileName - 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 partpublic java.lang.String getString(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic java.lang.String getSubmittedFileName()
javax.servlet.http.Partnull if no file name is available or if
this part is not a file upload.getSubmittedFileName in interface Partnull.Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.