cziegeler    2002/06/28 01:22:56

  Modified:    .        changes.xml
               src/java/org/apache/cocoon/components/request
                        MaybeUploadRequestFactoryImpl.java
  Log:
  Applied patch from [EMAIL PROTECTED] (Stuart Roebuck) with minor 
modifications
  
  Revision  Changes    Path
  1.199     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.198
  retrieving revision 1.199
  diff -u -r1.198 -r1.199
  --- changes.xml       28 Jun 2002 08:01:00 -0000      1.198
  +++ changes.xml       28 Jun 2002 08:22:56 -0000      1.199
  @@ -39,6 +39,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="CZ" type="fix" fixes-bug="10254" due-to="Stuart Roebuck" 
due-to-email="[EMAIL PROTECTED] ">
  +   Applied patch for MaybeUploadRequestFactoryImpl which sets the timeout for a 
session to
  +   infinite during an upload and restores it afterwards.
  +  </action>
     <action dev="CH" type="update">
      Multiple results seem not to be supported by some DBMSs (i.e. Oracle and
      Informix). Therefore this is made optional in ESQL. A new parameter
  
  
  
  1.3       +18 -3     
xml-cocoon2/src/java/org/apache/cocoon/components/request/MaybeUploadRequestFactoryImpl.java
  
  Index: MaybeUploadRequestFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/request/MaybeUploadRequestFactoryImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MaybeUploadRequestFactoryImpl.java        12 Mar 2002 14:26:59 -0000      1.2
  +++ MaybeUploadRequestFactoryImpl.java        28 Jun 2002 08:22:56 -0000      1.3
  @@ -53,6 +53,7 @@
   import uk.co.weft.maybeupload.MaybeUploadRequestWrapper;
   
   import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpSession;
   import java.io.File;
   import java.util.Map;
   import java.util.Vector;
  @@ -83,8 +84,17 @@
           }
   
           if (contentType.startsWith("multipart/form-data")) {
  +            int oldInterval = -1;
  +            HttpSession session = null;
               try {
  -                req = new MaybeUploadRequestWrapperEx(request,
  +                 // Change the session timeout to infinite whilst the upload takes 
place,
  +                 // to prevent a timeout occuring during a long upload.
  +                 session = req.getSession(false);
  +                 if ( null != session) {
  +                     oldInterval = session.getMaxInactiveInterval();
  +                     session.setMaxInactiveInterval( -1 );
  +                 }
  +                 req = new MaybeUploadRequestWrapperEx(request,
                                            saveUploadedFilesToDisk,
                                            uploadDirectory,
                                            allowOverwrite,
  @@ -92,7 +102,12 @@
                                            maxUploadSize);
               } catch (Exception e) {
                   req = request;
  -            }
  +            } finally {
  +                if ( null != session) {
  +                    // Reinstate the old session timeout interval upon completion 
or failure.
  +                    session.setMaxInactiveInterval(oldInterval);
  +                }
  +           }
           }
   
           return req;
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to