er.extensions.foundation
Class ERXFileContext
java.lang.Object
er.extensions.foundation.ERXFileContext
public class ERXFileContext
- extends java.lang.Object
A class to encapsulate a file reference and related information in the
context of web application usage.
Very commonly, you want a user friendly name for a download file or you want
to grab the filename of a file that the client uploaded, yet you might
have the file data streamed to or from a temporary file with a long meaningless unique name in
temp directory. This class just makes it convenient to have a real file, a client upload or download filename
and a mimetype bundled together in one class.
Useful for custom components that wrap FileUpload allowing you to bind a single ERXFileContext instead
of 3 bindings. You can bind the attributes of this class to any of the standard file upload WOComponent bindings
that match the 3 attributes encapsulated by this class.
Useful for passing around file download information as a single object rather than fiddling with 3 pieces of information.
- Author:
- kieran
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ERXFileContext
public ERXFileContext()
ERXFileContext
public ERXFileContext(java.io.File file)
ERXFileContext
public ERXFileContext(java.io.File file,
java.lang.String clientFileName,
java.lang.String mimeType)
ERXFileContext
public ERXFileContext(java.lang.String path)
reset
public void reset()
file
public java.io.File file()
- Returns:
- the
File
setFile
public void setFile(java.io.File file)
- Parameters:
file
-
path
public java.lang.String path()
- Returns:
- the absolute pathname of the file
setPath
public void setPath(java.lang.String path)
- Parameters:
path
- the absolute pathname of the file
clientFileName
public java.lang.String clientFileName()
- Returns:
- the file name from the perspective of the client or user, for
example the original name of a file that was uploaded, or the
name we are assigning to a file to be downloaded which may be
different to the temporary and/or unique name that we assign in
the file system.
setClientFileName
public void setClientFileName(java.lang.String clientFileName)
- Parameters:
clientFileName
-
mimeType
public java.lang.String mimeType()
- Returns:
- the File mime-type
setMimeType
public void setMimeType(java.lang.String mimeType)
- Parameters:
mimeType
- the File mime-type
extension
public java.lang.String extension()
- Returns the extension for the file represented by the receiver.
- Returns:
- the extension of the filename (or null)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2002 – 2007 Project Wonder.