pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.service.request
Class UploadedFile

java.lang.Object
  extended by org.torweg.pulse.service.request.TemporaryFile
      extended by org.torweg.pulse.service.request.UploadedFile
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, ITemporaryFile, IUploadedFile, SessionBindingListener

public class UploadedFile
extends TemporaryFile
implements IUploadedFile

A container for an uploaded file with a static method to process all file uploads in a ServiceRequestImpl.

Version:
$Revision: 1664 $
Author:
Thomas Weber
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.torweg.pulse.service.request.IUploadedFile
IUploadedFile.AutoDelete
 
Constructor Summary
UploadedFile(org.apache.commons.fileupload.FileItem item, User user)
          creates a new uploaded file.
UploadedFile(java.io.InputStream in, java.lang.String fn, java.lang.String pn)
          creates an uploaded file from a given InputStream.
 
Method Summary
 IUploadedFile.AutoDelete getAutoDelete()
          returns the auto-delete mode.
 java.lang.String getOriginalFileName()
          get the original name of the uploaded file.
 java.lang.String getParameterName()
          get the name of the form field this file was uploaded from.
 void setAutoDelete(IUploadedFile.AutoDelete ad)
          sets the auto-delete mode.
 java.lang.String toString()
          returns a string representation of the DownloadEvent.
 void valueBound()
          set the auto-delete mode to AutoDelete#OFF and calls the super-method.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
          set the auto-delete mode to AutoDelete#OFF and calls the super-method.
 
Methods inherited from class org.torweg.pulse.service.request.TemporaryFile
getFile, setFile, valueUnbound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.torweg.pulse.service.request.IUploadedFile
getFile
 
Methods inherited from interface org.torweg.pulse.service.request.SessionBindingListener
valueUnbound
 

Constructor Detail

UploadedFile

public UploadedFile(java.io.InputStream in,
                    java.lang.String fn,
                    java.lang.String pn)
creates an uploaded file from a given InputStream.

Parameters:
in - the input stream
fn - the file name
pn - the parameter name

UploadedFile

public UploadedFile(org.apache.commons.fileupload.FileItem item, User user)
             throws java.io.IOException
creates a new uploaded file.

Parameters:
item - a File
user - the user performing the upload
Throws:
java.io.IOException - on errors creating the temporary file for the upload
Method Detail

getOriginalFileName

public final java.lang.String getOriginalFileName()
get the original name of the uploaded file.

Specified by:
getOriginalFileName in interface IUploadedFile
Returns:
the original name of the uploaded file

getParameterName

public final java.lang.String getParameterName()
get the name of the form field this file was uploaded from.

Specified by:
getParameterName in interface IUploadedFile
Returns:
the name of the form field

getAutoDelete

public IUploadedFile.AutoDelete getAutoDelete()
returns the auto-delete mode.

Specified by:
getAutoDelete in interface IUploadedFile
Returns:
the auto-delete mode

setAutoDelete

public final void setAutoDelete(IUploadedFile.AutoDelete ad)
sets the auto-delete mode.

Specified by:
setAutoDelete in interface IUploadedFile
Parameters:
ad - the mode to set

valueBound

public void valueBound()
set the auto-delete mode to AutoDelete#OFF and calls the super-method.

Specified by:
valueBound in interface SessionBindingListener
Overrides:
valueBound in class TemporaryFile
See Also:
TemporaryFile.valueBound()

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
set the auto-delete mode to AutoDelete#OFF and calls the super-method.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
Overrides:
valueBound in class TemporaryFile
Parameters:
e - is passed upwards
See Also:
TemporaryFile.valueBound()

toString

public java.lang.String toString()
returns a string representation of the DownloadEvent.

Overrides:
toString in class java.lang.Object
Returns:
a string representation