Removed most of the "retry" in rescue clauses, since it was hidding critical issue.
This should be the choice of the application to "retry" on exception, otherwise let the framework handle this in the lower part. Better handling of response termination (alias commit) Added the notion of "status_committed"
This commit is contained in:
@@ -38,15 +38,10 @@ feature -- Execution
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
l_handled: BOOLEAN
|
||||
rescued: BOOLEAN
|
||||
do
|
||||
if not rescued then
|
||||
l_handled := router.dispatch (req, res)
|
||||
if not l_handled then
|
||||
execute_default (req, res)
|
||||
end
|
||||
else
|
||||
execute_rescue (req, res)
|
||||
l_handled := router.dispatch (req, res)
|
||||
if not l_handled then
|
||||
execute_default (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,14 +49,6 @@ feature -- Execution
|
||||
deferred
|
||||
end
|
||||
|
||||
execute_rescue (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if not res.header_committed then
|
||||
res.put_header ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||
end
|
||||
res.flush
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -26,6 +26,12 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Status report
|
||||
|
||||
status_committed: BOOLEAN
|
||||
-- Status line committed?
|
||||
do
|
||||
Result := wgi_response.status_committed
|
||||
end
|
||||
|
||||
header_committed: BOOLEAN
|
||||
-- Header committed?
|
||||
do
|
||||
@@ -56,7 +62,7 @@ feature -- Status setting
|
||||
-- Set response status code
|
||||
-- Should be done before sending any data back to the client
|
||||
require
|
||||
status_not_set: not status_is_set
|
||||
status_not_set: not status_committed
|
||||
header_not_committed: not header_committed
|
||||
do
|
||||
wgi_response.set_status_code (a_code)
|
||||
|
||||
@@ -26,11 +26,18 @@ feature -- Execution
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- WGI Execution
|
||||
feature {WGI_CONNECTOR} -- WGI Execution
|
||||
|
||||
wgi_execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
local
|
||||
w_res: detachable WSF_RESPONSE
|
||||
do
|
||||
execute (create {WSF_REQUEST}.make_from_wgi (req), create {WSF_RESPONSE}.make_from_wgi (res))
|
||||
create w_res.make_from_wgi (res)
|
||||
execute (create {WSF_REQUEST}.make_from_wgi (req), w_res)
|
||||
rescue
|
||||
if w_res /= Void then
|
||||
w_res.flush
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user