Implemented more user friendly WSF_RESPONSE

i.e allow to change the status code and the header as long as no content is really sent back to the client

This requires an addition WGI_RESPONSE, new post_commit_action: PROCEDURE [...]
This commit is contained in:
Jocelyn Fiat
2013-03-12 16:52:45 +01:00
parent 82784529fe
commit 86777d75ea
8 changed files with 342 additions and 32 deletions

View File

@@ -133,10 +133,10 @@ feature -- Server
res: detachable WGI_NINO_RESPONSE_STREAM
do
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current)
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), Void)
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), create {WGI_NINO_ERROR_STREAM}.make_stderr (a_socket.descriptor.out))
req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text)
service.execute (req, res)
res.commit
res.push
end
note

View File

@@ -0,0 +1,70 @@
note
description: "Summary description for WGI_CGI_ERROR_STREAM."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
WGI_NINO_ERROR_STREAM
inherit
WGI_ERROR_STREAM
create
make,
make_stderr,
make_stdout
feature {NONE} -- Initialization
make (a_identifier: READABLE_STRING_8; a_file: PLAIN_TEXT_FILE)
do
identifier := a_identifier
output := a_file
end
make_stderr (a_identifier: READABLE_STRING_8)
do
make (a_identifier, io.error)
end
make_stdout (a_identifier: READABLE_STRING_8)
do
make (a_identifier, io.error)
end
feature -- Access
identifier: READABLE_STRING_8
output: FILE
feature -- Error
put_error (a_message: READABLE_STRING_8)
local
s: STRING
do
create s.make (a_message.count + identifier.count + 4)
s.append_character ('[')
s.append (identifier)
s.append_character (']')
s.append_character (' ')
s.append (a_message)
s.append_character ('%N')
-- Display it at once.
output.put_string (s)
end
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