Fixed assertion that were broken with recent delayed header response.

Changed semantic of put_header_lines and add_header_lines,
Now the arguments are iterable of string (i.e the header line)

The previous features were not used, and were not well named.
So we removed them, and reused the names for adpated implementation.
This commit is contained in:
Jocelyn Fiat
2013-03-22 16:06:10 +01:00
parent 665772bda2
commit c44cf5e983
4 changed files with 17 additions and 12 deletions

View File

@@ -11,17 +11,17 @@ feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit
push push
-- Commit and push response -- Commit and push response
do do
commit
if attached post_commit_action as act then if attached post_commit_action as act then
act.call (Void) act.call (Void)
end end
commit
end end
commit commit
-- Commit the current response -- Commit the current response
deferred deferred
ensure ensure
status_is_set: status_is_set status_committed: status_committed
header_committed: header_committed header_committed: header_committed
message_committed: message_committed message_committed: message_committed
end end

View File

@@ -14,7 +14,8 @@ inherit
put_string, put_string,
put_substring, put_substring,
flush, flush,
message_writable message_writable,
message_committed
end end
WSF_RESPONSE_EXPORTER WSF_RESPONSE_EXPORTER
@@ -36,10 +37,10 @@ feature {NONE} -- Implementation
commit commit
do do
Precursor
if not header_committed then if not header_committed then
process_header process_header
end end
Precursor
end end
process_header process_header
@@ -65,6 +66,12 @@ feature -- Status report
message_writable: BOOLEAN = True message_writable: BOOLEAN = True
-- Can message be written? -- Can message be written?
message_committed: BOOLEAN
-- <Precursor>
do
Result := header_committed
end
feature -- Output operation feature -- Output operation
put_character (c: CHARACTER_8) put_character (c: CHARACTER_8)

View File

@@ -252,23 +252,23 @@ feature -- Header output operation: helpers
message_writable: message_writable message_writable: message_writable
end end
put_header_lines (a_lines: ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]) put_header_lines (a_lines: ITERABLE [READABLE_STRING_8])
-- Put headers from `a_lines' -- Put headers from `a_lines'
require require
header_not_committed: not header_committed header_not_committed: not header_committed
do do
across a_lines as c loop across a_lines as c loop
put_header_line (c.item.name + ": " + c.item.value) put_header_line (c.item)
end end
end end
add_header_lines (a_lines: ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]) add_header_lines (a_lines: ITERABLE [READABLE_STRING_8])
-- Add headers from `a_lines' -- Add headers from `a_lines'
require require
header_not_committed: not header_committed header_not_committed: not header_committed
do do
across a_lines as c loop across a_lines as c loop
add_header_line (c.item.name + ": " + c.item.value) add_header_line (c.item)
end end
end end
@@ -409,8 +409,7 @@ feature -- Response object
do do
a_message.send_to (Current) a_message.send_to (Current)
ensure ensure
status_committed: status_committed status_committed: status_is_set
header_committed: header_committed
end end
feature -- Redirect feature -- Redirect

View File

@@ -26,11 +26,10 @@ feature {WSF_RESPONSE} -- Output
deferred deferred
ensure ensure
res_status_set: res.status_is_set res_status_set: res.status_is_set
res_header_committed: res.header_committed
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