Added WSF_SERVICE.to_wgi_service to ease direct integration with existing WGI components

This commit is contained in:
Jocelyn Fiat
2012-03-20 11:40:13 +01:00
parent 9eef812795
commit 482f8e41e7
5 changed files with 10 additions and 30 deletions

View File

@@ -10,7 +10,7 @@ feature -- Access
local
cgi: WGI_CGI_CONNECTOR
do
create cgi.make (Current)
create cgi.make (to_wgi_service)
cgi.launch
end

View File

@@ -18,7 +18,7 @@ feature -- Access
print ("Example: start a Nino web server on port " + port_number.out +
", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N")
end
create app.make_custom (agent wgi_execute, base_url)
create app.make_custom (to_wgi_service), base_url)
app.force_single_threaded
app.listen (port_number)

View File

@@ -84,7 +84,7 @@ feature -- Helpers
end
rep_data.set_message (s)
end
rep_data.send (res)
res.send (rep_data)
rep_data.recycle
end

View File

@@ -10,12 +10,6 @@ note
deferred class
WSF_SERVICE
--inherit
-- WGI_SERVICE
-- rename
-- execute as wgi_execute
-- end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -26,25 +20,13 @@ feature -- Execution
deferred
end
--feature {WGI_CONNECTOR} -- WGI Execution
feature -- Conversion
-- wgi_execute (req: WGI_REQUEST; res: WGI_RESPONSE)
-- 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)
-- execute (w_req, w_res)
-- w_req.destroy
-- rescue
-- if w_res /= Void then
-- w_res.flush
-- end
-- if w_req /= Void then
-- w_req.destroy
-- end
-- end
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, Eiffel Software and others"

View File

@@ -35,12 +35,10 @@ feature {NONE} -- Events
app: NINO_SERVICE
wt: WORKER_THREAD
e: EXECUTION_ENVIRONMENT
w2w: WSF_TO_WGI_SERVICE
do
port_number := 0
base_url := "test/"
create w2w.make_from_service (Current)
create app.make_custom (w2w, base_url)
create app.make_custom (to_wgi_service, base_url)
web_app := app
create wt.make (agent app.listen (port_number))