SPT Core API

com.sptci.echo2
Class FileUploadListener<S>

java.lang.Object
  extended by com.sptci.echo2.FileUploadListener<S>
All Implemented Interfaces:
EventListener, nextapp.echo2.app.filetransfer.UploadListener

public class FileUploadListener<S>
extends Object
implements nextapp.echo2.app.filetransfer.UploadListener

A file upload listener for reading and storing files uploaded from the client browser.

Copyright 2006 Sans Pareil Technologies, Inc.

Version:
$Id: FileUploadListener.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2006-11-23

Constructor Summary
FileUploadListener(S source, String callback)
          Create a new instance of the listener, which will save the contents of the uploaded read to an file named after the original uploaded file and to the system java.io.tmpdir.
FileUploadListener(String path, S source, String callback)
          Create a new instance of the listener, which will save the contents of the uploaded file to an file named after the original uploaded file and to the specified path.
 
Method Summary
 void fileUpload(nextapp.echo2.app.filetransfer.UploadEvent event)
          Implementation of the method that handles file upload events.
 String getContentType()
          Returns contentType.
 String getFileName()
          Returns fileName.
 int getSize()
          Returns size.
 void invalidFileUpload(nextapp.echo2.app.filetransfer.UploadEvent event)
          The implementation of the method that handles invalid upload requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUploadListener

public FileUploadListener(S source,
                          String callback)
Create a new instance of the listener, which will save the contents of the uploaded read to an file named after the original uploaded file and to the system java.io.tmpdir. After the file upload the specified callback method will be invoked on the source object.

Parameters:
source - The source object on which the callback method should be invoked.
callback - The name of the callback method to invoke. This method must take a File as its sole parameter.

FileUploadListener

public FileUploadListener(String path,
                          S source,
                          String callback)
Create a new instance of the listener, which will save the contents of the uploaded file to an file named after the original uploaded file and to the specified path. After the file upload the specified callback method will be invoked on the source object.

Parameters:
path - The path value to use to store the file.
source - The source object on which the callback method should be invoked.
callback - The name of the callback method to invoke. This method must take a File as its sole parameter.
Method Detail

invalidFileUpload

public void invalidFileUpload(nextapp.echo2.app.filetransfer.UploadEvent event)
The implementation of the method that handles invalid upload requests.

Specified by:
invalidFileUpload in interface nextapp.echo2.app.filetransfer.UploadListener

fileUpload

public void fileUpload(nextapp.echo2.app.filetransfer.UploadEvent event)
Implementation of the method that handles file upload events.

Specified by:
fileUpload in interface nextapp.echo2.app.filetransfer.UploadListener
Parameters:
event - The upload event that triggered the upload.
See Also:
initFile(nextapp.echo2.app.filetransfer.UploadEvent), writeFile(java.io.File, java.io.InputStream)

getFileName

public final String getFileName()
Returns fileName.

Returns:
String The reference to fileName.

getContentType

public final String getContentType()
Returns contentType.

Returns:
String The reference to contentType.

getSize

public final int getSize()
Returns size.

Returns:
int The value of size.

SPT Core API