Fixed WSF_FILE_RESPONSE and WSF_DOWNLOAD_RESPONSE
and set the status code to be Ok by default
This commit is contained in:
@@ -19,6 +19,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
make (a_file_name: READABLE_STRING_8)
|
make (a_file_name: READABLE_STRING_8)
|
||||||
do
|
do
|
||||||
|
set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
file_name := a_file_name
|
file_name := a_file_name
|
||||||
base_name := basename (a_file_name)
|
base_name := basename (a_file_name)
|
||||||
get_content_type
|
get_content_type
|
||||||
@@ -28,6 +29,7 @@ feature {NONE} -- Initialization
|
|||||||
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
|
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
|
||||||
-- Initialize `Current'.
|
-- Initialize `Current'.
|
||||||
do
|
do
|
||||||
|
set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
file_name := a_filename
|
file_name := a_filename
|
||||||
base_name := basename (a_filename)
|
base_name := basename (a_filename)
|
||||||
content_type := a_content_type
|
content_type := a_content_type
|
||||||
@@ -54,6 +56,14 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
|
set_base_name (n: like base_name)
|
||||||
|
do
|
||||||
|
base_name := n
|
||||||
|
header.put_content_disposition ("attachment", "filename=%""+ n +"%"")
|
||||||
|
ensure
|
||||||
|
base_name_set: n.same_string (base_name)
|
||||||
|
end
|
||||||
|
|
||||||
set_expires (t: INTEGER)
|
set_expires (t: INTEGER)
|
||||||
do
|
do
|
||||||
header.put_expires (t)
|
header.put_expires (t)
|
||||||
@@ -91,7 +101,7 @@ feature -- Element change
|
|||||||
set_status_code (c: like status_code)
|
set_status_code (c: like status_code)
|
||||||
-- Set `status_code' to `c'.
|
-- Set `status_code' to `c'.
|
||||||
require
|
require
|
||||||
valid_status_code: status_code > 0
|
valid_status_code: c > 0
|
||||||
do
|
do
|
||||||
status_code := c
|
status_code := c
|
||||||
ensure
|
ensure
|
||||||
@@ -207,8 +217,11 @@ feature -- Implementation: output
|
|||||||
f.close
|
f.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
invariant
|
||||||
|
status_code_set: status_code /= 0
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
make (a_file_name: READABLE_STRING_8)
|
make (a_file_name: READABLE_STRING_8)
|
||||||
do
|
do
|
||||||
|
set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
file_name := a_file_name
|
file_name := a_file_name
|
||||||
get_content_type
|
get_content_type
|
||||||
initialize
|
initialize
|
||||||
@@ -27,6 +28,7 @@ feature {NONE} -- Initialization
|
|||||||
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
|
make_with_content_type (a_content_type: READABLE_STRING_8; a_filename: READABLE_STRING_8)
|
||||||
-- Initialize `Current'.
|
-- Initialize `Current'.
|
||||||
do
|
do
|
||||||
|
set_status_code ({HTTP_STATUS_CODE}.ok)
|
||||||
file_name := a_filename
|
file_name := a_filename
|
||||||
content_type := a_content_type
|
content_type := a_content_type
|
||||||
initialize
|
initialize
|
||||||
@@ -279,7 +281,7 @@ feature {NONE} -- Implementation: output
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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
|
||||||
|
|||||||
Reference in New Issue
Block a user