struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <>
Subject Re: AW: AW: DownloadAction Application
Date Mon, 07 Mar 2005 20:05:49 GMT
Yes, it does, sort of.  Check ThresholdingOutputStream and
DeferredFileOutputStream.   My UploadOutputStream overrides the
write(byte data[], int i, int j) method to monitor the upload.  Once
you have the hook of the monitor variable in the upload process, you
can do whatever you like during the read.  The Monitor class is, as
you can see from the wiki, an interface and the code given below does
not insert a monitor but a List of monitors into the process.  You can
do lots of things with this: cut the upload off, monitor the upload,
send emails, read protocols and their relation to file extensions,
etc.  This is what I have been trying to make possible, among other
things, while using ActionForm as well as Action in Struts v1.3 and

Pretty cool, eh?

public class UploadOutputStream
    extends DeferredFileOutputStream {
  private List  monitors;
  private boolean isFormField;

  public UploadOutputStream(int     threshold,
                            File    outputFile,
                            List    monitors,
                            boolean isFormField) {
    super(threshold, outputFile);
    this.monitors = monitors;
    this.isFormField = isFormField;

  public void write(byte data[], int i, int j)
      throws IOException {
    super.write(data, i, j);
    if((monitors != null) && (! isFormField)) {
      Iterator iter = monitors.iterator();
      while(iter.hasNext()) {

On Mon, 7 Mar 2005 14:28:37 -0500 (EST), Frank W. Zammetti
<> wrote:
> I'd be willing to bet Commons does the same thing, but I don't know for
> sure.  Anyone reading this able to illuminate us?
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message