Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-305

Wrong example for file download

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • unspecified
    • 4.1.1
    • Documentation
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            fidlej Ivo Danihelka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: