removed implementation from APPLICATION , RESPONSE and REQUEST classes

This commit is contained in:
Jocelyn Fiat
2011-07-27 15:11:07 +02:00
parent 4075b08b7e
commit 694c0a193c
5 changed files with 85 additions and 66 deletions

View File

@@ -11,7 +11,8 @@ deferred class
inherit
GW_APPLICATION
redefine
process
process,
rescue_execute
end
feature -- Access
@@ -28,6 +29,19 @@ feature -- Execution
Precursor (env, a_input, a_output)
end
rescue_execute (req: detachable GW_REQUEST; res: detachable GW_RESPONSE; a_exception: detachable EXCEPTION)
-- Operation processed on rescue of `execute'
do
if
req /= Void and res /= Void
and a_exception /= Void and then attached a_exception.exception_trace as l_trace
then
res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void)
res.write_string ("<pre>" + l_trace + "</pre>")
end
Precursor (req, res, a_exception)
end
feature -- Factory
new_request (env: GW_ENVIRONMENT; a_input: GW_INPUT_STREAM): GW_REQUEST
@@ -36,7 +50,7 @@ feature -- Factory
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
end
new_response (a_output: GW_OUTPUT_STREAM): GW_RESPONSE
new_response (req: GW_REQUEST; a_output: GW_OUTPUT_STREAM): GW_RESPONSE
do
create {GW_RESPONSE_IMP} Result.make (a_output)
end

View File

@@ -28,15 +28,7 @@ feature {NONE} -- Initialization
body: STRING_8
feature -- Status setting
set_status_code (c: INTEGER)
-- Set the status code of the response
do
header.put_status (c)
end
feature -- Output operation
feature {NONE} -- Status output
write (s: STRING)
-- Send the content of `s'
@@ -44,6 +36,8 @@ feature -- Output operation
body.append (s)
end
feature -- Output operation
write_file_content (fn: STRING)
-- Send the content of file `fn'
local
@@ -73,6 +67,7 @@ feature {GW_APPLICATION} -- Commit
commit (a_output: GW_OUTPUT_STREAM)
do
a_output.put_status (status_code)
header.send_to (a_output)
write (body)
Precursor (a_output)