Hello, Frank,

If you don't mind, I would like to talk to you a bit about what you
think is needed, so that I can be effective.  Essentially the code is
an attempt to do two things:

1.  Show how a slight change which can be made consistent with past
upload code in Struts can make life good for people who want to code
their own upload application.

2.  Show how such an application might look, so that the idea of the
changes makes sense.

Part One (1) involves the first three interfaces which replace the
present code and provide interfaces the present code can live with.  I
assume taht these interfaces are so obvious that comments are not too
necessary with them.

public interface MultipartFile
    extends Serializable {
  public long        getSize();
  public void        setSize(long fileSize);
  public String      getName();
  public void        setName(String fileName);
  public String      getContentType();
  public void        setContentType(String fileContentType);
  public byte[]      getData();
  public InputStream getInputStream();
  public void        reset();
}

public interface MultipartData {
  public Iterator getParameterNames();
  public String   getParameter(String name);
  public String[] getParameterValues(String name);
  public Map      getFiles();
}

public interface MultipartHandler {
  public void          handleRequest(Object [] params) throws IOException;
  public ActionMapping getMapping();
  public void          setMapping(ActionMapping mapping);
  public ActionServlet getServlet();
  public void          setServlet(ActionServlet servlet);
}


The first part of the Second Part (2) is more complicated, but the
only classes of any import are just implementations of the rather
obvious interfaces.  The second part of the Second Part (2) is much
more complicated and cannot really be understood without the rest of
the application.  This is not too important except for showing how an
Upload class that acts as the glue between the upload application and
the Struts framework might look.  I want access to ActionForm so that
I can use the ActionForm in the application that feeds the Upload
class and so that Monitor subclasses can have a framework basis to
return data too.

Given this, what do you think would be helpful to you?  Keep it in
mind that my goal is not to focus on the applicatoin at present but on
the proposed opening up of the Struts framework.  I can code this on
my own and use it, but I would rather it were possible for others to
also provide sample applicatoins.

Is this helpful?

Jack


On Fri, 11 Mar 2005 00:25:41 -0500, Frank W. Zammetti
<[EMAIL PROTECTED]> wrote:
> Jack, one comment on this... I think it would be helpful to comment the
> code you've posted.
> 
> Frank
> 
> dev@struts.apache.org wrote:
> >    Date: 2005-03-10T21:20:10
> >    Editor: DakotaJack
> >    Wiki: Apache Struts Wiki
> >    Page: StrutsUpload
> >    URL: http://wiki.apache.org/struts/StrutsUpload
> >
> >    no comment
> >
> > Change Log:
> >
> > ------------------------------------------------------------------------------
> > @@ -70,10 +70,13 @@
> >   3.  !UploadFileItemFactory (extends 
> > org.apache.commons.fileupload.!DefaultFileItemFactory)
> >   4.  Monitor
> >   5.  Upload
> > + 6.  !UploadParams
> >
> >  == Code ==
> >
> > -=== MultipartFile ===
> > +=== Framework Code ===
> > +
> > +==== MultipartFile ====
> >
> >  {{{
> >  public interface MultipartFile
> > @@ -90,7 +93,7 @@
> >  }
> >  }}}
> >
> > -=== MultipartData ===
> > +==== MultipartData ====
> >
> >  {{{
> >  public interface MultipartData {
> > @@ -101,7 +104,7 @@
> >  }
> >  }}}
> >
> > -=== MultipartHandler ===
> > +==== MultipartHandler ====
> >
> >  {{{
> >  public interface MultipartHandler {
> > @@ -113,7 +116,7 @@
> >  }
> >  }}}
> >
> > -=== MultipartUtil ===
> > +==== MultipartUtil ====
> >
> >  {{{
> >  public class MultipartUtil {
> > @@ -138,7 +141,9 @@
> >  }
> >  }}}
> >
> > -=== UploadMultipartFile ===
> > +=== Framework Code Sample Implementation ===
> > +
> > +==== UploadMultipartFile ====
> >
> >  {{{
> >  public class UploadMultipartFile
> > @@ -230,7 +235,7 @@
> >  }
> >  }}}
> >
> > -=== UploadMultipartData ===
> > +==== UploadMultipartData ====
> >
> >  {{{
> >  public class UploadMultipartData
> > @@ -313,7 +318,7 @@
> >  }
> >  }}}
> >
> > -=== UploadMultipartHandler ===
> > +==== UploadMultipartHandler ====
> >
> >  {{{
> >  public class UploadMultipartHandler
> > @@ -423,7 +428,10 @@
> >  }
> >  }}}
> >
> > -=== UploadOutputStream ===
> > +
> > +=== Sample Application Code Pieces ===
> > +
> > +==== UploadOutputStream ====
> >
> >
> >  {{{
> > @@ -454,7 +462,7 @@
> >  }
> >  }}}
> >
> > -=== UploadFileItem ===
> > +==== UploadFileItem ====
> >
> >  {{{
> >  public class UploadFileItem
> > @@ -661,7 +669,7 @@
> >  }
> >  }}}
> >
> > -=== UploadFileItemFactory ===
> > +==== UploadFileItemFactory ====
> >
> >  {{{
> >  public class UploadFileItemFactory
> > @@ -704,7 +712,7 @@
> >  }
> >  }}}
> >
> > -=== Monitor ===
> > +==== Monitor ====
> >
> >  {{{
> >  public interface Monitor {
> > @@ -714,7 +722,7 @@
> >  }
> >  }}}
> >
> > -=== Upload ===
> > +==== Upload ====
> >
> >  {{{
> >  public class Upload {
> > @@ -1111,6 +1119,89 @@
> >        return excluded = false;
> >      }
> >      return excluded;
> > +  }
> > +}
> > +}}}
> > +
> > +==== UploadParams ====
> > +
> > +{{{
> > +public class UploadParams
> > +    implements Serializable {
> > +
> > +  private String fileName;
> > +  private String uploadStatus;
> > +  private long   fileSize;    // file size
> > +  private String contentType;
> > +  private String filePath;    // store location
> > +  private String storeType;   // store storeType
> > +  private String overwriteFileName;
> > +  private String fileExt;
> > +  private String overwriteFileExt;
> > +
> > +  public UploadParams(String fileName,
> > +                      String uploadStatus,
> > +                      long   fileSize,
> > +                      String contentType,
> > +                      String storeType,
> > +                      String filePath,
> > +                      String overwriteFileName) {
> > +    this.fileName          = fileName;
> > +    this.uploadStatus      = uploadStatus;
> > +    this.fileSize          = fileSize;
> > +    this.contentType       = contentType;
> > +    this.storeType         = storeType;
> > +    this.filePath          = filePath;
> > +    this.overwriteFileName = overwriteFileName;
> > +
> > +    if(fileName != null) {
> > +      int j = fileName.lastIndexOf(".");
> > +      if(j != -1)
> > +        fileExt = fileName.substring(j + 1, fileName.length());
> > +    }
> > +
> > +    if(overwriteFileName != null) {
> > +      int k = overwriteFileName.lastIndexOf(".");
> > +      if(k != -1) {
> > +        overwriteFileExt = overwriteFileName.substring(k + 1, 
> > overwriteFileName.length());
> > +      }
> > +    }
> > +  }
> > +
> > +  public String getContentType() {
> > +    return contentType;
> > +  }
> > +
> > +  public String getFileExt() {
> > +    return fileExt;
> > +  }
> > +
> > +  public String getFileName() {
> > +    return fileName;
> > +  }
> > +
> > +  public String getFilePath() {
> > +    return filePath;
> > +  }
> > +
> > +  public long getFileSize() {
> > +    return fileSize;
> > +  }
> > +
> > +  public String getOverwriteFileExt() {
> > +    return overwriteFileExt;
> > +  }
> > +
> > +  public String getOverwriteFileName() {
> > +    return overwriteFileName;
> > +  }
> > +
> > +  public String getStoreType() {
> > +    return storeType;
> > +  }
> > +
> > +  public String getUploadStatus() {
> > +    return uploadStatus;
> >    }
> >  }
> >  }}}
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to