You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Dakota Jack <da...@gmail.com> on 2005/03/06 06:40:14 UTC

Re: [Apache Struts Wiki] Updated: StrutsUpload

This is too typical.  I get this sort of thing all the time.  It is
becoming humorous.

James, there are, respectively, seriatim, two hours exactly and two
hours and twenty-four minutes between posts.  That should have been a
little *clue* that these posts are unrelated and, so, you advice must
be off the track.  If push came to shove, you could actually have read
the posts, and then you would have seen that they are unrelated and
that one could hardly be a preview for another.

Why do you think you would send me advice that is obviously unrelated
to what I had done prior to looking at what I had done?  I assume you
mean well, but imagine how discouraging it is for a person trying to
be of assistance to get criticism on posts that the person doing the
criticizing never bothered to read or even to briefly think about?  If
you don't know, it is very discouraging and it is only because I am
bullheaded and have had to walk through this sort of prejudice all my
life that I don't just say "screw it".

Anyway, one of us owes the other an apology, and I don't think it is
me.  Like I said, I assume you meant well, but they say "the road to
hell is paved with good intentions".  Please read my posts prior to
giving advice which is so far from the truth that it is just plain
quizzical.

On Sun, 6 Mar 2005 00:00:39 -0500, James Mitchell <jm...@apache.org> wrote:
> Not trying to be rude here, but you can help us all out by using the
> "Preview" instead of the "Save" when making multiple changes.  That helps
> keep the noise down ;
> 
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
> 
> ----- Original Message -----
> From: <de...@struts.apache.org>
> To: <de...@struts.apache.org>
> Sent: Saturday, March 05, 2005 6:30 PM
> Subject: [Apache Struts Wiki] Updated: StrutsUpload
> 
>    Date: 2005-03-05T15:30:46
>    Editor: DakotaJack
>    Wiki: Apache Struts Wiki
>    Page: StrutsUpload
>    URL: http://wiki.apache.org/struts/StrutsUpload
> 
>    no comment
> 
> Change Log:
> 
> ------------------------------------------------------------------------------
> @@ -1,5 +1,50 @@
>  == Overview ==
> 
> +Utilizing the sort of structure suggested for Struts upload below allows us
> to have an !ActionUpload class as follows:
> +
> +(This is actual code used in a working application online.)
> +
> +{{{
> +public class UploadAction
> +    extends Action {
> +  public ActionForward execute(ActionMapping       mapping,
> +                               ActionForm          form,
> +                               HttpServletRequest  req,
> +                               HttpServletResponse res)
> +      throws Exception {
> +    HttpSession    sess   = req.getSession();
> +    Upload         upload =
> (Upload)sess.getAttribute(UploadConstant.UPLOAD);
> +
> +    if(upload == null) {
> +      upload = new Upload();
> +      sess.setAttribute(UploadConstant.UPLOAD,upload);
> +    }
> +
> +    if(upload.isMultipart(req)) {
> +      Monitor progress =
> (UploadMonitorProgress)sess.getAttribute(UploadConstant.MONITOR);
> +
> +      if(progress == null) {
> +        progress = new UploadMonitorProgress();
> +        sess.setAttribute(UploadConstant.MONITOR,progress);
> +      }
> +
> +      List monitors = Collections.synchronizedList(new LinkedList());
> +      monitors.add(progress);
> +      String userStore = LoadFileUtil.getUploadPath(user.getId());
> +
> +      upload.setStore(UploadConstant.DIR,userStore);
> +      upload.setStoreTmpDir(LoadFileUtil.UPLOAD_TEMP_FILES);
> +
> upload.process(req,monitors,UploadConstant.DEFAULT_ENCODING,UploadConstant.MAX_UPLOADED_FILE_SIZE);
> +      upload.store();
> +
> +
> sess.setAttribute(UploadConstant.REPORT,UploadReport.getReport(upload));
> +    }
> +
> +    return new ActionForward(...);;
> +  }
> +}
> +}}}
> +
>  The point of this presentation is not the classes given.  The point is that
> I am would hope that the committers working on the Struts multipart
> processing would make some attempt to provide a basis for applications other
> than the Struts upload package.  These classes are not meant to be that
> basis, other than the so-called "Framework Code" given below.  If the code
> given so far is not sufficient to get a response other than the usual
> indifference, I will just go my own way.
> 
>  This is about Struts v1.2.6 and forward multipart requests.  The first
> seven classes/interfaces are suggested as a basis for allowing Struts
> users/developers to implement their own file upload applications.  The
> object of suggesting these classes is to make the use of !ActionForm
> available to users/developers who want to do something more than the present
> default file upload application packaged with Struts allows but maintaining
> backward compatibility.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
> 


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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org