Added SCOOP support for WSF.
WSF_SERVICE is deeply changed, and addition of WSF_EXECUTION. Todo: code cleaning, removing useless things.
This commit is contained in:
@@ -4,18 +4,18 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE_I [G -> WSF_SERVICE_LAUNCHER create make_and_launch end]
|
||||
WSF_DEFAULT_SERVICE_I [G -> WSF_SERVICE_LAUNCHER [WSF_EXECUTION] create make_and_launch end]
|
||||
|
||||
inherit
|
||||
WSF_LAUNCHABLE_SERVICE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
l_launcher: G
|
||||
do
|
||||
create l_launcher.make_and_launch (a_service, opts)
|
||||
create l_launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
note
|
||||
|
||||
@@ -14,7 +14,7 @@ feature {NONE} -- Initialization
|
||||
frozen make_and_launch
|
||||
do
|
||||
initialize
|
||||
launch (Current, service_options)
|
||||
launch (service_options)
|
||||
end
|
||||
|
||||
initialize
|
||||
@@ -25,7 +25,7 @@ feature {NONE} -- Initialization
|
||||
|
||||
service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
|
||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
deferred
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ feature -- Default service options
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -10,26 +10,8 @@ note
|
||||
deferred class
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the request
|
||||
-- See `req.input' for input stream
|
||||
-- `req.meta_variables' for the CGI meta variable
|
||||
-- and `res' for output buffer
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_wgi_service: WGI_SERVICE
|
||||
-- Adapt Current WSF Service to plug into WGI component
|
||||
do
|
||||
create {WSF_TO_WGI_SERVICE} Result.make_from_service (Current)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -32,45 +32,31 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_SERVICE_LAUNCHER
|
||||
WSF_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_TO_WGI_SERVICE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
frozen make (a_service: like service; a_options: like options)
|
||||
frozen make (a_options: like options)
|
||||
do
|
||||
make_from_service (a_service)
|
||||
options := a_options
|
||||
initialize
|
||||
ensure
|
||||
service_set: service = a_service
|
||||
options_set: options = a_options
|
||||
launchable: launchable
|
||||
end
|
||||
|
||||
frozen make_and_launch (a_service: like service; a_options: like options)
|
||||
frozen make_and_launch (a_options: like options)
|
||||
do
|
||||
make (a_service, a_options)
|
||||
make (a_options)
|
||||
launch
|
||||
end
|
||||
|
||||
frozen make_callback (a_callback: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; a_options: like options)
|
||||
do
|
||||
make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options)
|
||||
end
|
||||
|
||||
frozen make_callback_and_launch (a_callback: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; a_options: like options)
|
||||
do
|
||||
make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options)
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize Current using `options' if attached
|
||||
-- and build the connector
|
||||
require
|
||||
service_set: service /= Void
|
||||
deferred
|
||||
ensure
|
||||
connector_attached: connector /= Void
|
||||
@@ -120,7 +106,7 @@ invariant
|
||||
connector_attached: connector /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -13,47 +13,8 @@ class
|
||||
inherit
|
||||
WGI_SERVICE
|
||||
|
||||
create
|
||||
make_from_service
|
||||
|
||||
feature {NONE} -- Make
|
||||
|
||||
make_from_service (a_service: like service)
|
||||
-- Make from WSF_SERVICE `a_service'
|
||||
do
|
||||
service := a_service
|
||||
end
|
||||
|
||||
service: WSF_SERVICE
|
||||
-- Associated WSF_SERVICE
|
||||
|
||||
feature {WGI_CONNECTOR} -- Implementation: Execution
|
||||
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
-- Delegate the WGI processing to the WSF_SERVICE object
|
||||
-- <Precursor>
|
||||
local
|
||||
w_res: detachable WSF_RESPONSE
|
||||
w_req: detachable WSF_REQUEST
|
||||
do
|
||||
create w_res.make_from_wgi (res)
|
||||
create w_req.make_from_wgi (req)
|
||||
service.execute (w_req, w_res)
|
||||
w_req.destroy
|
||||
rescue
|
||||
if w_res /= Void then
|
||||
if not (w_res.status_committed or w_res.header_committed) then
|
||||
w_res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
|
||||
end
|
||||
w_res.flush
|
||||
end
|
||||
if w_req /= Void then
|
||||
w_req.destroy
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -7,6 +7,17 @@ note
|
||||
deferred class
|
||||
WSF_EXECUTION
|
||||
|
||||
inherit
|
||||
WGI_EXECUTION
|
||||
rename
|
||||
request as wgi_request,
|
||||
response as wgi_response
|
||||
redefine
|
||||
make,
|
||||
execute,
|
||||
clean
|
||||
end
|
||||
|
||||
--create
|
||||
-- make
|
||||
|
||||
@@ -14,24 +25,72 @@ feature {NONE} -- Initialization
|
||||
|
||||
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
do
|
||||
create request.make_from_wgi (req)
|
||||
create response.make_from_wgi (res)
|
||||
Precursor (req, res)
|
||||
create request.make_from_wgi (wgi_request)
|
||||
create response.make_from_wgi (wgi_response)
|
||||
end
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
request: WSF_REQUEST
|
||||
-- Access to request data.
|
||||
-- Header, Query, Post, Input data..
|
||||
|
||||
response: WSF_RESPONSE
|
||||
-- Access to output stream, back to the client.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
message_writable: BOOLEAN
|
||||
do
|
||||
Result := response.message_writable
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
put_character (c: CHARACTER_8)
|
||||
require
|
||||
message_writable: message_writable
|
||||
do
|
||||
response.put_character (c)
|
||||
end
|
||||
|
||||
put_string (s: READABLE_STRING_8)
|
||||
require
|
||||
message_writable: message_writable
|
||||
do
|
||||
response.put_string (s)
|
||||
end
|
||||
|
||||
put_error (err: READABLE_STRING_8)
|
||||
require
|
||||
message_writable: message_writable
|
||||
do
|
||||
response.put_error (err)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
-- Execute Current `request',
|
||||
-- getting data from `request'
|
||||
-- and response to client via `response'.
|
||||
deferred
|
||||
ensure
|
||||
response.status_is_set
|
||||
ensure then
|
||||
status_is_set: response.status_is_set
|
||||
end
|
||||
|
||||
feature -- Cleaning
|
||||
|
||||
clean
|
||||
-- Precursor
|
||||
do
|
||||
Precursor
|
||||
request.destroy
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -41,7 +41,7 @@ inherit
|
||||
{NONE} all
|
||||
end
|
||||
|
||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION}
|
||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION, WGI_EXPORTER}
|
||||
make_from_wgi
|
||||
|
||||
convert
|
||||
@@ -426,7 +426,7 @@ feature -- Eiffel WGI access
|
||||
Result := wgi_request.wgi_implementation
|
||||
end
|
||||
|
||||
wgi_connector: detachable WGI_CONNECTOR
|
||||
wgi_connector: detachable separate WGI_CONNECTOR
|
||||
-- Associated Eiffel WGI connector
|
||||
do
|
||||
Result := wgi_request.wgi_connector
|
||||
|
||||
@@ -19,7 +19,7 @@ note
|
||||
class
|
||||
WSF_RESPONSE
|
||||
|
||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION}
|
||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION, WGI_EXPORTER}
|
||||
make_from_wgi
|
||||
|
||||
create {WSF_RESPONSE}
|
||||
|
||||
Reference in New Issue
Block a user