cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/reading ResourceReader.java
Date Fri, 12 Jan 2001 09:47:48 GMT
giacomo     01/01/12 01:47:47

  Modified:    src/org/apache/cocoon/reading Tag: xml-cocoon2
                        ResourceReader.java
  Log:
  Added the capability to specify an <expires/> parameter to allow
  proxy servers to cache the resource served by the resourceReader component
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +17 -1     xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- ResourceReader.java	2000/12/08 20:39:59	1.1.2.8
  +++ ResourceReader.java	2001/01/12 09:47:47	1.1.2.9
  @@ -28,7 +28,19 @@
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/12/08 20:39:59 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/01/12 09:47:47 $
  + *
  + * The <code>ResourceReader</code> component is used to serve binary data
  + * in a sitemap pipeline.
  + *
  + * Parameters:
  + *   <dl>
  + *     <dt>&lt;expires&gt;</dt>
  + *       <dd>This parameter is optional. When specified it determines how long
  + *           in miliseconds the resources can be cached by any proxy between
  + *           Cocoon2 and the requesting browser.
  + *       </dd>
  + *   </dl>
    */
   public class ResourceReader extends AbstractReader {
   
  @@ -77,6 +89,10 @@
           is.close();
           res.setContentLength(buffer.length);
           res.setDateHeader("Last-Modified", lastModified);
  +        long expires = par.getParameterAsInteger("expires", -1);
  +        if (expires > 0) {
  +            res.setDateHeader("Expires", System.currentTimeMillis()+expires);
  +        }
           res.setHeader("Accept-Ranges", "bytes");
           out.write ( buffer );
       }
  
  
  

Mime
View raw message