add output helper feature to RESPONSE

This commit is contained in:
Jocelyn Fiat
2011-07-18 16:29:43 +02:00
parent 8a38519fb0
commit 0a1c4676a4

View File

@@ -20,6 +20,48 @@ feature -- Access: Output
header.send_to (output) header.send_to (output)
end end
feature -- Output operation
write_string (s: STRING)
do
output.put_string (s)
end
write_file_content (fn: STRING)
-- Send the content of file `fn'
do
output.put_file_content (fn)
end
write_header (a_status: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]])
-- Send headers with status `a_status', and headers from `a_headers'
local
h: GW_HEADER
i,n: INTEGER
do
h := header
h.put_status (a_status)
if a_headers /= Void then
from
i := a_headers.lower
n := a_headers.upper
until
i > n
loop
h.put_header_key_value (a_headers[i].key, a_headers[i].value)
i := i + 1
end
end
send_header
end
write_header_line (s: STRING)
-- Send `s' to http client as header line
do
write_string (s)
write_string ("%R%N")
end
feature -- Header feature -- Header
header: GW_HEADER header: GW_HEADER