org.apache.tapestry.multipart
Class UploadPart

java.lang.Object
  |
  +--org.apache.tapestry.multipart.UploadPart
All Implemented Interfaces:
IPart, IUploadFile

public class UploadPart
extends Object
implements IUploadFile, IPart

Portion of a multi-part request representing an uploaded file.

Since:
2.0.1
Version:
$Id: UploadPart.java,v 1.5 2003/05/28 13:41:45 hlship Exp $
Author:
Joe Panico

Constructor Summary
UploadPart(org.apache.commons.fileupload.FileItem fileItem)
           
 
Method Summary
 void cleanup()
          Deletes the external content file, if one exists.
 String getContentType()
          Returns the MIME type specified when the file was uploaded.
 String getFileName()
          Leverages File to convert the full file path and extract the name.
 String getFilePath()
          Returns the complete path, as reported by the client browser.
 InputStream getStream()
          Returns an input stream of the content of the file.
static UploadPart newInstance(String path, String name, String contentType, int requestSize, int threshold)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadPart

public UploadPart(org.apache.commons.fileupload.FileItem fileItem)
Method Detail

newInstance

public static UploadPart newInstance(String path,
                                     String name,
                                     String contentType,
                                     int requestSize,
                                     int threshold)

getContentType

public String getContentType()
Description copied from interface: IUploadFile
Returns the MIME type specified when the file was uploaded. May return null if the content type is not known.

Specified by:
getContentType in interface IUploadFile

getFileName

public String getFileName()
Leverages File to convert the full file path and extract the name.

Specified by:
getFileName in interface IUploadFile

getFilePath

public String getFilePath()
Description copied from interface: IUploadFile
Returns the complete path, as reported by the client browser. Different browsers report different things here.

Specified by:
getFilePath in interface IUploadFile
Since:
2.0.4

getStream

public InputStream getStream()
Description copied from interface: IUploadFile
Returns an input stream of the content of the file. There is no guarantee that this stream will be valid after the end of the current request cycle, so it should be processed immediately.

As of release 1.0.8, this will be a a ByteArrayInputStream, but that, too, may change (a future implementation may upload the stream to a temporary file and return an input stream from that).

Specified by:
getStream in interface IUploadFile

cleanup

public void cleanup()
Deletes the external content file, if one exists.

Specified by:
cleanup in interface IPart
See Also:
cleanup()