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
Part
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.
delete
in interface Part
IOException
- if an I/O occurs while attempting to delete the partpublic String getContentType()
Part
getContentType
in interface Part
null
if
not defined.public String getHeader(String name)
Part
public Collection<String> getHeaderNames()
Part
getHeaderNames
in interface Part
public Collection<String> getHeaders(String name)
Part
getHeaders
in interface Part
name
- The name of the header of interest. The header name is case
insensitive.public InputStream getInputStream() throws IOException
Part
InputStream
that can be used to retrieve the
contents of the file.getInputStream
in interface Part
IOException
- if an I/O occurs while obtaining the streampublic String getName()
Part
public long getSize()
Part
public void write(String fileName) throws IOException
Part
write
in interface Part
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 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.