Break inheritance from WGI_RESPONSE, since it is not flexible for future improvement.
This commit is contained in:
@@ -8,9 +8,6 @@ note
|
|||||||
class
|
class
|
||||||
WSF_RESPONSE
|
WSF_RESPONSE
|
||||||
|
|
||||||
inherit
|
|
||||||
WGI_RESPONSE
|
|
||||||
|
|
||||||
create {WSF_SERVICE}
|
create {WSF_SERVICE}
|
||||||
make_from_wgi
|
make_from_wgi
|
||||||
|
|
||||||
@@ -58,8 +55,14 @@ feature -- Status setting
|
|||||||
set_status_code (a_code: INTEGER)
|
set_status_code (a_code: INTEGER)
|
||||||
-- Set response status code
|
-- Set response status code
|
||||||
-- Should be done before sending any data back to the client
|
-- Should be done before sending any data back to the client
|
||||||
|
require
|
||||||
|
status_not_set: not status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
do
|
do
|
||||||
wgi_response.set_status_code (a_code)
|
wgi_response.set_status_code (a_code)
|
||||||
|
ensure
|
||||||
|
status_code_set: status_code = a_code
|
||||||
|
status_set: status_is_set
|
||||||
end
|
end
|
||||||
|
|
||||||
status_code: INTEGER
|
status_code: INTEGER
|
||||||
@@ -68,20 +71,27 @@ feature -- Status setting
|
|||||||
Result := wgi_response.status_code
|
Result := wgi_response.status_code
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WGI_RESPONSE} -- Core output operation
|
--feature {WGI_RESPONSE} -- Core output operation
|
||||||
|
--
|
||||||
write (s: READABLE_STRING_8)
|
-- write (s: READABLE_STRING_8)
|
||||||
-- Send the string `s'
|
-- -- Send the string `s'
|
||||||
-- this can be used for header and body
|
-- -- this can be used for header and body
|
||||||
do
|
-- do
|
||||||
wgi_response.write (s)
|
-- wgi_response.write (s)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
feature -- Header output operation
|
feature -- Header output operation
|
||||||
|
|
||||||
write_header_text (a_headers: READABLE_STRING_8)
|
write_header_text (a_headers: READABLE_STRING_8)
|
||||||
|
require
|
||||||
|
status_set: status_is_set
|
||||||
|
header_not_committed: not header_committed
|
||||||
do
|
do
|
||||||
wgi_response.write_header_text (a_headers)
|
wgi_response.write_header_text (a_headers)
|
||||||
|
ensure
|
||||||
|
status_set: status_is_set
|
||||||
|
header_committed: header_committed
|
||||||
|
message_writable: message_writable
|
||||||
end
|
end
|
||||||
|
|
||||||
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: READABLE_STRING_8; value: READABLE_STRING_8]])
|
write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||||
@@ -122,12 +132,16 @@ feature -- Output operation
|
|||||||
|
|
||||||
write_string (s: READABLE_STRING_8)
|
write_string (s: READABLE_STRING_8)
|
||||||
-- Send the string `s'
|
-- Send the string `s'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
do
|
do
|
||||||
wgi_response.write_string (s)
|
wgi_response.write_string (s)
|
||||||
end
|
end
|
||||||
|
|
||||||
write_substring (s: READABLE_STRING_8; a_begin_index, a_end_index: INTEGER)
|
write_substring (s: READABLE_STRING_8; a_begin_index, a_end_index: INTEGER)
|
||||||
-- Send the substring `s[a_begin_index:a_end_index]'
|
-- Send the substring `s[a_begin_index:a_end_index]'
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
do
|
do
|
||||||
wgi_response.write_substring (s, a_begin_index, a_end_index)
|
wgi_response.write_substring (s, a_begin_index, a_end_index)
|
||||||
end
|
end
|
||||||
@@ -137,6 +151,8 @@ feature -- Output operation
|
|||||||
-- If s is Void, this means this was the final chunk
|
-- If s is Void, this means this was the final chunk
|
||||||
-- Note: that you should have header
|
-- Note: that you should have header
|
||||||
-- "Transfer-Encoding: chunked"
|
-- "Transfer-Encoding: chunked"
|
||||||
|
require
|
||||||
|
message_writable: message_writable
|
||||||
local
|
local
|
||||||
hex: STRING
|
hex: STRING
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
@@ -208,14 +224,6 @@ feature -- Redirect
|
|||||||
redirect_now_with_custom_status_code (a_url, {HTTP_STATUS_CODE}.moved_permanently)
|
redirect_now_with_custom_status_code (a_url, {HTTP_STATUS_CODE}.moved_permanently)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WGI_RESPONSE, WGI_SERVICE} -- Commit
|
|
||||||
|
|
||||||
commit
|
|
||||||
-- Commit the current response
|
|
||||||
do
|
|
||||||
wgi_response.commit
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2011, Eiffel Software and others"
|
copyright: "2011-2011, 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)"
|
||||||
|
|||||||
Reference in New Issue
Block a user