Package org.apache.catalina.core
Class ApplicationPart
- java.lang.Object
- 
- org.apache.catalina.core.ApplicationPart
 
- 
- 
Constructor SummaryConstructors Constructor Description ApplicationPart(FileItem fileItem, java.io.File location)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Deletes the underlying storage for a part, including deleting any associated temporary disk file.java.lang.StringgetContentType()Obtain the content type passed by the browser.java.lang.StringgetHeader(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.InputStreamgetInputStream()Obtain anInputStreamthat can be used to retrieve the contents of the file.java.lang.StringgetName()Obtain the name of the field in the multipart form corresponding to this part.longgetSize()Obtain the size of this part.java.lang.StringgetString(java.lang.String encoding)java.lang.StringgetSubmittedFileName()If this part represents an uploaded file, gets the file name submitted in the upload.voidwrite(java.lang.String fileName)A convenience method to write an uploaded part to disk.
 
- 
- 
- 
Constructor Detail- 
ApplicationPartpublic ApplicationPart(FileItem fileItem, java.io.File location) 
 
- 
 - 
Method Detail- 
deletepublic void delete() throws java.io.IOExceptionDescription copied from interface:javax.servlet.http.PartDeletes the underlying storage for a part, including deleting any associated temporary disk file. Although the container will delete this storage automatically this method can be used to ensure that this is done at an earlier time, thus preserving system resources.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. 
 - 
getContentTypepublic java.lang.String getContentType() Description copied from interface:javax.servlet.http.PartObtain the content type passed by the browser.- Specified by:
- getContentTypein interface- Part
- Returns:
- The content type passed by the browser or nullif not defined.
 
 - 
getHeaderpublic java.lang.String getHeader(java.lang.String name) Description copied from interface:javax.servlet.http.PartObtains the value of the specified part header as a String. If there are multiple headers with the same name, this method returns the first header in the part. The header name is case insensitive.
 - 
getHeaderNamespublic java.util.Collection<java.lang.String> getHeaderNames() Description copied from interface:javax.servlet.http.PartGet the header names provided for this part.- Specified by:
- getHeaderNamesin interface- Part
- Returns:
- a Collection of all the header names provided for this part.
 
 - 
getHeaderspublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name) Description copied from interface:javax.servlet.http.PartObtain all the values of the specified part header.- Specified by:
- getHeadersin interface- Part
- Parameters:
- name- The name of the header of interest. The header name is case insensitive.
- Returns:
- All the values of the specified part header. If the part did not include any headers of the specified name, this method returns an empty Collection.
 
 - 
getInputStreampublic java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from interface:javax.servlet.http.PartObtain anInputStreamthat can be used to retrieve the contents of the file.- Specified by:
- getInputStreamin interface- Part
- Returns:
- An InputStream for the contents of the file
- Throws:
- java.io.IOException- if an I/O occurs while obtaining the stream
 
 - 
getNamepublic java.lang.String getName() Description copied from interface:javax.servlet.http.PartObtain the name of the field in the multipart form corresponding to this part.
 - 
getSizepublic long getSize() Description copied from interface:javax.servlet.http.PartObtain the size of this part.
 - 
writepublic void write(java.lang.String fileName) throws java.io.IOExceptionDescription copied from interface:javax.servlet.http.PartA convenience method to write an uploaded part to disk. The client code is not concerned with whether or not the part is stored in memory, or on disk in a temporary location. They just want to write the uploaded part to a file. This method is not guaranteed to succeed if called more than once for the same part. This allows a particular implementation to use, for example, file renaming, where possible, rather than copying all of the underlying data, thus gaining a significant performance benefit.- Specified by:
- writein interface- Part
- Parameters:
- fileName- The location into which the uploaded part should be stored. Relative locations are relative to- MultipartConfigElement.getLocation()
- Throws:
- java.io.IOException- if an I/O occurs while attempting to write the part
 
 - 
getStringpublic java.lang.String getString(java.lang.String encoding) throws java.io.UnsupportedEncodingException, java.io.IOException- Throws:
- java.io.UnsupportedEncodingException
- java.io.IOException
 
 - 
getSubmittedFileNamepublic java.lang.String getSubmittedFileName() Description copied from interface:javax.servlet.http.PartIf this part represents an uploaded file, gets the file name submitted in the upload. Returnsnullif no file name is available or if this part is not a file upload.- Specified by:
- getSubmittedFileNamein interface- Part
- Returns:
- the submitted file name or null.
 
 
- 
 
-