org.melati.servlet
Class DefaultFileFormDataAdaptor

Package class diagram package DefaultFileFormDataAdaptor
java.lang.Object
  extended by org.melati.servlet.BaseFileFormDataAdaptor
      extended by org.melati.servlet.DefaultFileFormDataAdaptor
All Implemented Interfaces:
FormDataAdaptor

public class DefaultFileFormDataAdaptor
extends BaseFileFormDataAdaptor

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  String uploadDir
           
protected  String uploadURL
           
 
Fields inherited from class org.melati.servlet.BaseFileFormDataAdaptor
BUFSIZE, field, file, url
 
Constructor Summary
DefaultFileFormDataAdaptor(Melati melatiP, String uploadDirP, String uploadUrlP)
          Constructor.
DefaultFileFormDataAdaptor(Melati melatiP, String uploadDirP, String uploadURLP, boolean makeUniqueP)
          Constructor.
 
Method Summary
protected  File calculateLocalFile()
           
protected  String calculateURL()
          Return a URL to the saved file, null if not appropriate.
 
Methods inherited from class org.melati.servlet.BaseFileFormDataAdaptor
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 String uploadDir

uploadURL

protected String uploadURL

makeUnique

protected boolean makeUnique
Constructor Detail

DefaultFileFormDataAdaptor

public DefaultFileFormDataAdaptor(Melati melatiP,
                                  String uploadDirP,
                                  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)

DefaultFileFormDataAdaptor

public DefaultFileFormDataAdaptor(Melati melatiP,
                                  String uploadDirP,
                                  String uploadURLP,
                                  boolean makeUniqueP)
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)
makeUnique - Whether we should make sure the new file has a unique name within the uploadDir directory
Method Detail

calculateLocalFile

protected File calculateLocalFile()
Specified by:
calculateLocalFile in class BaseFileFormDataAdaptor
Returns:
The file in which to save the data

calculateURL

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

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


Copyright © 2000-2010 PanEris. All Rights Reserved.