| Constructor and Description |
|---|
ApplicationPart(FileItem fileItem,
File location) |
| 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 |
getFilename()
Deprecated.
Use
getSubmittedFileName() from Servlet 3.1 instead.
This method will be removed in Tomcat 8. |
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.
|
String |
getString(String encoding) |
String |
getSubmittedFileName()
Adapted from FileUploadBase.getFileName().
|
void |
write(String fileName)
A convenience method to write an uploaded part to disk.
|
public void delete()
throws IOException
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.
delete in interface PartIOException - if an I/O occurs while attempting to delete the partpublic String getContentType()
PartgetContentType in interface Partnull if
not defined.public String getHeader(String name)
Partpublic Collection<String> getHeaderNames()
PartgetHeaderNames in interface Partpublic Collection<String> getHeaders(String name)
PartgetHeaders in interface Partname - The name of the header of interest. The header name is case
insensitive.public InputStream getInputStream() throws IOException
PartInputStream that can be used to retrieve the
contents of the file.getInputStream in interface PartIOException - if an I/O occurs while obtaining the streampublic String getName()
Partpublic long getSize()
Partpublic void write(String fileName) throws IOException
Partwrite in interface PartfileName - 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 partpublic String getString(String encoding) throws UnsupportedEncodingException
UnsupportedEncodingException@Deprecated public String getFilename()
getSubmittedFileName() from Servlet 3.1 instead.
This method will be removed in Tomcat 8.getSubmittedFileName().public String getSubmittedFileName()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.