ERXFileContext Class Reference

Collaboration diagram for ERXFileContext:

Collaboration graph
[legend]

List of all members.

Public Member Functions

String clientFileName ()
 ERXFileContext (String path)
 ERXFileContext (File file, String clientFileName, String mimeType)
 ERXFileContext (File file)
 ERXFileContext ()
String extension ()
File file ()
String mimeType ()
String path ()
void reset ()
void setClientFileName (String clientFileName)
void setFile (File file)
void setMimeType (String mimeType)
void setPath (String path)
String toString ()

Private Member Functions

String extensionForFileName (String fileName)

Private Attributes

String _clientFileName
File _file
String _mimeType
String _path


Detailed Description

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

Constructor & Destructor Documentation

ERXFileContext (  ) 

ERXFileContext ( File  file  ) 

ERXFileContext ( File  file,
String  clientFileName,
String  mimeType 
)

ERXFileContext ( String  path  ) 


Member Function Documentation

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.

String extension (  ) 

Returns the extension for the file represented by the receiver.

Returns:
the extension of the filename (or null)

String extensionForFileName ( String  fileName  )  [private]

Returns the extension for the given filename.

Parameters:
fileName the filename
Returns:
the extension of the filename (or null)

File file (  ) 

Returns:
the File

String mimeType (  ) 

Returns:
the File mime-type

String path (  ) 

Returns:
the absolute pathname of the file

void reset (  ) 

void setClientFileName ( String  clientFileName  ) 

Parameters:
clientFileName 

void setFile ( File  file  ) 

Parameters:
file 

void setMimeType ( String  mimeType  ) 

Parameters:
mimeType the File mime-type

void setPath ( String  path  ) 

Parameters:
path the absolute pathname of the file

String toString (  ) 


Member Data Documentation

File _file [private]

String _mimeType [private]

String _path [private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:12 2012 for Project Wonder by  doxygen 1.5.8