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 |
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()
If this part represents an uploaded file, gets the file name submitted
in the upload.
|
void |
write(String fileName)
A convenience method to write an uploaded part to disk.
|
public void delete() throws IOException
javax.servlet.http.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()
javax.servlet.http.Part
getContentType
in interface Part
null
if
not defined.public String getHeader(String name)
javax.servlet.http.Part
public Collection<String> getHeaderNames()
javax.servlet.http.Part
getHeaderNames
in interface Part
public Collection<String> getHeaders(String name)
javax.servlet.http.Part
getHeaders
in interface Part
name
- The name of the header of interest. The header name is case
insensitive.public InputStream getInputStream() throws IOException
javax.servlet.http.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()
javax.servlet.http.Part
public long getSize()
javax.servlet.http.Part
public void write(String fileName) throws IOException
javax.servlet.http.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
public String getSubmittedFileName()
javax.servlet.http.Part
null
if no file name is available or if
this part is not a file upload.getSubmittedFileName
in interface Part
null
.Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.