|
DRAFT | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Part
This class represents a part or form item that was received within a
multipart/form-data
POST request.
Method Summary | |
---|---|
void |
delete()
Deletes the underlying storage for a file item, including deleting any associated temporary disk file. |
java.lang.String |
getContentType()
Gets the content type of this part. |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified mime header as a String . |
java.lang.Iterable<java.lang.String> |
getHeaderNames()
Returns an Iterable of all the header names this part contains. |
java.lang.Iterable<java.lang.String> |
getHeaders(java.lang.String name)
Returns all the values of the specified Part header as an Iterable of String objects. |
java.io.InputStream |
getInputStream()
Gets the content of this part as an InputStream |
java.lang.String |
getName()
Gets the name of this part |
long |
getSize()
Returns the size of this fille. |
void |
write(java.lang.String fileName)
A convenience method to write this uploaded item to disk. |
Method Detail |
---|
java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- If an error occurs in retrieving the contet
as an InputStreamjava.lang.String getContentType()
java.lang.String getName()
long getSize()
long
specifying the size of this part, in bytes.void write(java.lang.String fileName) throws java.io.IOException
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.
fileName
- aString
specifying the file name which the stream is written out to.
The file is created relative to the location as specified in the MultipartConfig
java.io.IOException
- if an error occurs.void delete() throws java.io.IOException
java.io.IOException
- if an error occurs.java.lang.String getHeader(java.lang.String name)
String
. If the Part did not include a header
of the specified name, this method returns null
.
If there are multiple headers with the same name, this method
returns the first header in the part.
The header name is case insensitive. You can use
this method with any request header.
name
- a String
specifying the
header name
String
containing the
value of the requested
header, or null
if the part does not
have a header of that namejava.lang.Iterable<java.lang.String> getHeaders(java.lang.String name)
Iterable
of String
objects.
If the Part did not include any headers
of the specified name, this method returns an empty
Iterable
.
The header name is case insensitive. You can use
this method with any Part header.
name
- a String
specifying the
header name
Iterable
containing
the values of the requested header. If
the Part does not have any headers of
that name return an empty
Iterable. If
the container does not allow access to
header information, return nulljava.lang.Iterable<java.lang.String> getHeaderNames()
Some servlet containers do not allow
servlets to access headers using this method, in
which case this method returns null
null
|
DRAFT | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.