Improved WSF download response implementation.

- Do not set Transfer-Encoding to binary for download response.
- Use WSF_RESPONSE.put_file_content (...)
This commit is contained in:
Jocelyn Fiat
2018-02-05 21:02:23 +01:00
parent 947c94644e
commit ffd7dd8540

View File

@@ -1,6 +1,6 @@
note note
description : "Objects that ..." description : "Objects that ..."
author : "$Author$" author : "$Author: jfiat $"
date : "$Date$" date : "$Date$"
revision : "$Revision$" revision : "$Revision$"
@@ -51,7 +51,6 @@ feature {NONE} -- Initialization
create h.make create h.make
header := h header := h
h.put_content_type (content_type) h.put_content_type (content_type)
h.put_transfer_encoding_binary
h.put_content_length (filesize (file_path)) h.put_content_length (filesize (file_path))
h.put_content_disposition ("attachment", "filename=%""+ base_name +"%"") h.put_content_disposition ("attachment", "filename=%""+ base_name +"%"")
if attached filedate (file_path) as dt then if attached filedate (file_path) as dt then
@@ -215,22 +214,14 @@ feature -- Implementation: output
create f.make_with_path (fn) create f.make_with_path (fn)
check f.exists and then f.is_readable end check f.exists and then f.is_readable end
f.open_read res.put_file_content (f, 0, f.count)
from
until
f.exhausted
loop
f.read_stream (4_096)
res.put_string (f.last_string)
end
f.close
end end
invariant invariant
status_code_set: status_code /= 0 status_code_set: status_code /= 0
note note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software