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

@@ -17,6 +17,7 @@ feature {NONE} -- Initialization
make_with_response (res: WGI_RESPONSE)
do
wgi_response := res
res.set_post_commit_action (agent commit)
end
wgi_response: WGI_RESPONSE
@@ -26,7 +27,7 @@ feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit
commit
-- Commit the current response
do
-- do nothing, this will be done internal on the original `wgi_response' object
wgi_response.set_post_commit_action (Void)
end
feature -- Status report
@@ -129,7 +130,7 @@ feature -- Error reporting
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -8,6 +8,15 @@ deferred class
feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit
push
-- Commit and push response
do
commit
if attached post_commit_action as act then
act.call (Void)
end
end
commit
-- Commit the current response
deferred
@@ -17,6 +26,21 @@ feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit
message_committed: message_committed
end
feature -- Access: commit
post_commit_action: detachable PROCEDURE [ANY, TUPLE]
-- Action associated with the final `commit' execution
-- Note: useful to trigger action just after the
-- response is transfered to the client.
feature -- Change: commit
set_post_commit_action (act: like post_commit_action)
-- Assign `act' to `post_commit_action'
do
post_commit_action := act
end
feature -- Status report
status_committed: BOOLEAN
@@ -131,7 +155,7 @@ feature -- Error reporting
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software