Renamed WGI_RESPONSE_BUFFER as WGI_RESPONSE to avoid confusion
Removed EWF_HEADER and removed related caller from WGI implementation,
now this is only part of WSF library
Added wgi_version, wgi_implementation and wgi_connector to the WGI_REQUEST interface
to give more information to the user
Added back WGI_CONNECTOR to WGI specification, mainly because of `{WGI_REQUEST}.wgi_connector'
simplified WGI_CONNECTOR to contain for now only `name' and `version'
if the implementation of connector inherit from WGI_CONNECTOR (recommended)
this might gives more access to the user using a reverse assignment for specific needs
(but this usage is not recommended due to portability issue on other connector)
Removed useless connector.ecf since now EWF/WGI library provides the helper classes
126 lines
2.3 KiB
Plaintext
126 lines
2.3 KiB
Plaintext
note
|
|
description: "[
|
|
WGI Response implemented using stream buffer
|
|
|
|
]"
|
|
date: "$Date$"
|
|
revision: "$Revision$"
|
|
|
|
class
|
|
WGI_RESPONSE_STREAM
|
|
|
|
inherit
|
|
WGI_RESPONSE
|
|
|
|
create
|
|
make
|
|
|
|
feature {NONE} -- Initialization
|
|
|
|
make (a_output: like output)
|
|
do
|
|
output := a_output
|
|
end
|
|
|
|
feature {WGI_SERVICE} -- Commit
|
|
|
|
commit
|
|
-- Commit the current response
|
|
do
|
|
output.flush
|
|
message_committed := True
|
|
end
|
|
|
|
feature -- Status report
|
|
|
|
header_committed: BOOLEAN
|
|
-- Header committed?
|
|
|
|
message_committed: BOOLEAN
|
|
-- Message committed?
|
|
|
|
message_writable: BOOLEAN
|
|
-- Can message be written?
|
|
do
|
|
Result := status_is_set and header_committed
|
|
end
|
|
|
|
feature {NONE} -- Core output operation
|
|
|
|
write (s: READABLE_STRING_8)
|
|
-- Send the content of `s'
|
|
-- this can be used for header and body
|
|
do
|
|
output.put_string (s)
|
|
end
|
|
|
|
feature -- Status setting
|
|
|
|
status_is_set: BOOLEAN
|
|
-- Is status set?
|
|
do
|
|
Result := status_code /= 0
|
|
end
|
|
|
|
set_status_code (a_code: INTEGER)
|
|
-- Set response status code
|
|
-- Should be done before sending any data back to the client
|
|
do
|
|
status_code := a_code
|
|
output.put_status_line (a_code)
|
|
end
|
|
|
|
status_code: INTEGER
|
|
-- Response status
|
|
|
|
feature -- Header output operation
|
|
|
|
write_headers (a_headers: READABLE_STRING_8)
|
|
do
|
|
write (a_headers)
|
|
header_committed := True
|
|
end
|
|
|
|
feature -- Output operation
|
|
|
|
write_string (s: READABLE_STRING_8)
|
|
-- Send the string `s'
|
|
do
|
|
write (s)
|
|
end
|
|
|
|
write_substring (s: READABLE_STRING_8; start_index, end_index: INTEGER)
|
|
-- Send the substring `start_index:end_index]'
|
|
--| Could be optimized according to the target output
|
|
do
|
|
output.put_substring (s, start_index, end_index)
|
|
end
|
|
|
|
write_file_content (fn: READABLE_STRING_8)
|
|
-- Send the content of file `fn'
|
|
do
|
|
output.put_file_content (fn)
|
|
end
|
|
|
|
flush
|
|
do
|
|
output.flush
|
|
end
|
|
|
|
feature {NONE} -- Implementation: Access
|
|
|
|
output: WGI_OUTPUT_STREAM
|
|
-- Server output channel
|
|
|
|
;note
|
|
copyright: "2011-2011, Eiffel Software and others"
|
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
|
source: "[
|
|
Eiffel Software
|
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
|
Telephone 805-685-1006, Fax 805-685-6869
|
|
Website http://www.eiffel.com
|
|
Customer support http://support.eiffel.com
|
|
]"
|
|
end
|