[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-dev
Subject:    [jira] Created: (TAPESTRY-305) Wrong example for file download
From:       "Ivo Danihelka (JIRA)" <tapestry-dev () jakarta ! apache ! org>
Date:       2005-04-28 7:42:24
Message-ID: 582505665.1114674144286.JavaMail.jira () ajax ! apache ! org
[Download RAW message or body]

Wrong example for file download
-------------------------------

         Key: TAPESTRY-305
         URL: http://issues.apache.org/jira/browse/TAPESTRY-305
     Project: Tapestry
        Type: Bug
  Components: Documentation  
    Versions: unspecified    
    Reporter: Ivo Danihelka
    Priority: Minor


Method InputStream.read(buffer) returns number of bytes read into the buffer.

Tapestry FAQ contains example "How do I stream a file to the user from tapestry?":
    byte[] data = new byte[1024];
...
    while (in.read(data) > -1)
    {
        out.write(data);
    }
=============
It should be something like:
    int len;
    while ((len = in.read(data)) > -1)
    {
        out.write(data, 0, len);
    }
=============
Or I'm wrong and response.setContentLength() will handle this?

Tapestry FAQ:
http://jakarta.apache.org/tapestry/faq.html#faq-N1012F


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic