org.melati.servlet
Class DefaultFileDataAdaptor

java.lang.Object
  extended by org.melati.servlet.BaseFileDataAdaptor
      extended by org.melati.servlet.DefaultFileDataAdaptor
All Implemented Interfaces:
FormDataAdaptor

public class DefaultFileDataAdaptor
extends BaseFileDataAdaptor

The default way to save an uploaded file to disk. We tell it what directory to save it in and the base URL to that directory.


Field Summary
protected  boolean makeUnique
           
protected  Melati melati
           
protected  java.lang.String uploadDir
           
protected  java.lang.String uploadURL
           
 
Fields inherited from class org.melati.servlet.BaseFileDataAdaptor
BUFSIZE, field, file, url
 
Constructor Summary
DefaultFileDataAdaptor(Melati melatiP, java.lang.String uploadDirP, java.lang.String uploadUrlP)
          Constructor.
DefaultFileDataAdaptor(Melati melatiP, java.lang.String uploadDir, java.lang.String uploadURL, boolean makeUnique)
          Constructor.
 
Method Summary
protected  java.io.File calculateLocalFile()
           
protected  java.lang.String calculateURL()
          Return a URL to the saved file, null if not appropriate.
 
Methods inherited from class org.melati.servlet.BaseFileDataAdaptor
getData, getFile, getSize, getURL, readData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

melati

protected Melati melati

uploadDir

protected java.lang.String uploadDir

uploadURL

protected java.lang.String uploadURL

makeUnique

protected boolean makeUnique
Constructor Detail

DefaultFileDataAdaptor

public DefaultFileDataAdaptor(Melati melatiP,
                              java.lang.String uploadDirP,
                              java.lang.String uploadUrlP)
Constructor.

Parameters:
melatiP - The current melati
uploadDirP - The directory to save this file in
uploadUrlP - A URL pointing to this directory (null if there isn't an appropriate URL)

DefaultFileDataAdaptor

public DefaultFileDataAdaptor(Melati melatiP,
                              java.lang.String uploadDir,
                              java.lang.String uploadURL,
                              boolean makeUnique)
Constructor.

Parameters:
melatiP - The current melati
uploadDir - The directory to save this file in
uploadURL - A URL pointing to this directory (null if there isn't an appropriate URL)
makeUnique - Whether we should make sure the new file has a unique name within the uploadDir directory
Method Detail

calculateLocalFile

protected java.io.File calculateLocalFile()
Specified by:
calculateLocalFile in class BaseFileDataAdaptor
Returns:
The file in which to save the data

calculateURL

protected java.lang.String calculateURL()
Description copied from class: BaseFileDataAdaptor
Return a URL to the saved file, null if not appropriate.

Specified by:
calculateURL in class BaseFileDataAdaptor
Returns:
a URL to the saved file, null if not appropriate


Copyright © 2000-2008 PanEris. All Rights Reserved.