Class ApplicationPart
java.lang.Object
org.apache.catalina.core.ApplicationPart
- All Implemented Interfaces:
Part
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Deletes the underlying storage for a part, including deleting any associated temporary disk file.Obtain the content type passed by the browser.Obtains the value of the specified part header as a String.Get the header names provided for this part.getHeaders(String name) Obtain all the values of the specified part header.Obtain anInputStreamthat can be used to retrieve the contents of the file.getName()Obtain the name of the field in the multipart form corresponding to this part.longgetSize()Obtain the size of this part.If this part represents an uploaded file, gets the file name submitted in the upload.voidA convenience method to write an uploaded part to disk.
-
Constructor Details
-
ApplicationPart
-
-
Method Details
-
delete
Description copied from interface:jakarta.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.
- Specified by:
deletein interfacePart- Throws:
IOException- if an I/O occurs while attempting to delete the part
-
getContentType
Description copied from interface:jakarta.servlet.http.PartObtain the content type passed by the browser.- Specified by:
getContentTypein interfacePart- Returns:
- The content type passed by the browser or
nullif not defined.
-
getHeader
Description copied from interface:jakarta.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. -
getHeaderNames
Description copied from interface:jakarta.servlet.http.PartGet the header names provided for this part.- Specified by:
getHeaderNamesin interfacePart- Returns:
- a Collection of all the header names provided for this part.
-
getHeaders
Description copied from interface:jakarta.servlet.http.PartObtain all the values of the specified part header.- Specified by:
getHeadersin interfacePart- 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.
-
getInputStream
Description copied from interface:jakarta.servlet.http.PartObtain anInputStreamthat can be used to retrieve the contents of the file.- Specified by:
getInputStreamin interfacePart- Returns:
- An InputStream for the contents of the file
- Throws:
IOException- if an I/O occurs while obtaining the stream
-
getName
Description copied from interface:jakarta.servlet.http.PartObtain the name of the field in the multipart form corresponding to this part. -
getSize
public long getSize()Description copied from interface:jakarta.servlet.http.PartObtain the size of this part. -
write
Description copied from interface:jakarta.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 interfacePart- Parameters:
fileName- The location into which the uploaded part should be stored. Relative locations are relative toMultipartConfigElement.getLocation()- Throws:
IOException- if an I/O occurs while attempting to write the part
-
getString
-
getSubmittedFileName
Description copied from interface:jakarta.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 interfacePart- Returns:
- the submitted file name or
null.
-