cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/reading ResourceReader.java
Date Wed, 20 Mar 2002 20:12:42 GMT
vgritsenko    02/03/20 12:12:42

  Modified:    src/java/org/apache/cocoon/reading ResourceReader.java
  Log:
  Fix bug #7156
  
  Revision  Changes    Path
  1.7       +9 -3      xml-cocoon2/src/java/org/apache/cocoon/reading/ResourceReader.java
  
  Index: ResourceReader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/reading/ResourceReader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ResourceReader.java	22 Feb 2002 07:03:54 -0000	1.6
  +++ ResourceReader.java	20 Mar 2002 20:12:42 -0000	1.7
  @@ -86,7 +86,7 @@
    *   </dl>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Id: ResourceReader.java,v 1.6 2002/02/22 07:03:54 cziegeler Exp $
  + * @version CVS $Id: ResourceReader.java,v 1.7 2002/03/20 20:12:42 vgritsenko Exp $
    */
   public class ResourceReader
     extends AbstractReader
  @@ -154,7 +154,7 @@
        */
       public void generate()
       throws IOException, ProcessingException {
  -        final Response response = ObjectModelHelper.getResponse( this.objectModel);
  +        final Response response = ObjectModelHelper.getResponse(this.objectModel);
   
           try {
               final long expires = parameters.getParameterAsInteger("expires", -1);
  @@ -163,6 +163,12 @@
                   response.setDateHeader("Expires", System.currentTimeMillis() + expires);
               }
   
  +            long contentLength = this.inputSource.getContentLength();
  +            if (contentLength != -1) {
  +                // FIXME (VG): Environment has setContentLength, and
  +                // Response interface has not. Strange.
  +                response.setHeader("Content-Length", Long.toString(contentLength));
  +            }
               response.setHeader("Accept-Ranges", "bytes");
   
               byte[] buffer = new byte[8192];
  @@ -184,7 +190,7 @@
        * Returns the mime-type of the resource in process.
        */
       public String getMimeType () {
  -        Context ctx = ObjectModelHelper.getContext( this.objectModel );
  +        Context ctx = ObjectModelHelper.getContext(this.objectModel);
   
           if (ctx != null) {
              return ctx.getMimeType(this.source);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message