[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...

Shane Bryzak Shane_Bryzak at symantec.com
Sat Feb 10 02:56:00 EST 2007


  User: sbryzak2
  Date: 07/02/10 02:56:00

  Modified:    src/main/org/jboss/seam/web  MultipartRequest.java
  Log:
  support file size value binding for file uploads
  
  Revision  Changes    Path
  1.2       +15 -0     jboss-seam/src/main/org/jboss/seam/web/MultipartRequest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MultipartRequest.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/MultipartRequest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- MultipartRequest.java	10 Feb 2007 07:32:34 -0000	1.1
  +++ MultipartRequest.java	10 Feb 2007 07:56:00 -0000	1.2
  @@ -120,6 +120,7 @@
      {
         private String filename;
         private String contentType;
  +      private int fileSize;
              
         private ByteArrayOutputStream bOut = null;
         private FileOutputStream fOut = null;
  @@ -150,6 +151,11 @@
            this.contentType = contentType;
         }
         
  +      public int getFileSize()
  +      {
  +         return fileSize;
  +      }      
  +      
         public void createTempFile()
         {
            try
  @@ -177,6 +183,8 @@
               if (bOut == null) bOut = new ByteArrayOutputStream();
               bOut.write(data, start, length);
            }
  +         
  +         fileSize += length;
         }
         
         public byte[] getData()
  @@ -499,6 +507,13 @@
                  ((FileParam) p).getFilename() : null;
      }   
      
  +   public int getFileSize(String name)
  +   {
  +      Param p = getParam(name);    
  +      return (p != null && p instanceof FileParam) ? 
  +               ((FileParam) p).getFileSize() : -1;      
  +   }
  +   
      @Override
      public String getParameter(String name)
      {
  
  
  



More information about the jboss-cvs-commits mailing list