ozeigermann    2004/12/13 08:49:27

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        PutMethod.java
  Log:
  Usage of memory buffers now is avoided in favor of a temporary file.
  
  Revision  Changes    Path
  1.89      +29 -26    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
  
  Index: PutMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- PutMethod.java    13 Dec 2004 16:19:38 -0000      1.88
  +++ PutMethod.java    13 Dec 2004 16:49:26 -0000      1.89
  @@ -231,22 +231,23 @@
                   }
                   // Changed for DeltaV --end--
                   
  +                // Creating revisionDescriptor associated with the object
                   if (revisionContent == null) {
                       revisionContent = new NodeRevisionContent();
  +                    revisionContent.setContent(req.getInputStream());
  +                    
  +                    // Get content length
  +                    int contentLength = req.getContentLength();
  +                    // we need to buffer the content to find out the content 
length
  +                    // and to save it for a retry
  +                    if (contentLength == -1 || retryUponConflict) {
  +                        contentLength = (int) 
revisionContent.bufferContent(revisionContent
  +                                .streamContent());
  +    //                    contentLength = 
revisionContent.getContentBytes().length;
  +                    }
  +                    revisionDescriptor.setContentLength(contentLength);
                   }
  -                //revisionContent.setContent(req.getReader());
  -                
  -                revisionContent.setContent(req.getInputStream());
  -                
  -                // Get content length
  -                int contentLength = req.getContentLength();
  -                // we need to buffer the content to find out the content 
length
  -                // and to save it for a retry
  -                if (contentLength == -1 || retryUponConflict) {
  -                     contentLength = 
revisionContent.getContentBytes().length;
  -                }
  -                revisionDescriptor.setContentLength(contentLength);
  -                
  +
                   // Last modification date
                   revisionDescriptor.setLastModified(new Date());
                   
  @@ -409,17 +410,19 @@
                   // Creating revisionDescriptor associated with the object
                   if (revisionContent == null) {
                       revisionContent = new NodeRevisionContent();
  +                    revisionContent.setContent(req.getInputStream());
  +                    
  +                    // Get content length
  +                    int contentLength = req.getContentLength();
  +                    // we need to buffer the content to find out the content 
length
  +                    // and to save it for a retry
  +                    if (contentLength == -1 || retryUponConflict) {
  +                        contentLength = (int) 
revisionContent.bufferContent(revisionContent
  +                                .streamContent());
  +    //                    contentLength = 
revisionContent.getContentBytes().length;
  +                    }
  +                    revisionDescriptor.setContentLength(contentLength);
                   }
  -                revisionContent.setContent(req.getInputStream());
  -                
  -                // Get content length
  -                int contentLength = req.getContentLength();
  -                // we need to buffer the content to find out the content 
length
  -                // and to save it for a retry
  -                if (contentLength == -1 || retryUponConflict) {
  -                    contentLength = revisionContent.getContentBytes().length;
  -                }
  -                revisionDescriptor.setContentLength(contentLength);
                   
                   content.create(slideToken, resourcePath, revisionDescriptor,
                                  revisionContent);
  
  
  

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

Reply via email to