Added WSF_SERVICE.to_wgi_service to ease direct integration with existing WGI components
This commit is contained in:
@@ -10,7 +10,7 @@ feature -- Access
|
|||||||
local
|
local
|
||||||
cgi: WGI_CGI_CONNECTOR
|
cgi: WGI_CGI_CONNECTOR
|
||||||
do
|
do
|
||||||
create cgi.make (Current)
|
create cgi.make (to_wgi_service)
|
||||||
cgi.launch
|
cgi.launch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ feature -- Access
|
|||||||
print ("Example: start a Nino web server on port " + port_number.out +
|
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")
|
", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N")
|
||||||
end
|
end
|
||||||
create app.make_custom (agent wgi_execute, base_url)
|
create app.make_custom (to_wgi_service), base_url)
|
||||||
app.force_single_threaded
|
app.force_single_threaded
|
||||||
|
|
||||||
app.listen (port_number)
|
app.listen (port_number)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ feature -- Helpers
|
|||||||
end
|
end
|
||||||
rep_data.set_message (s)
|
rep_data.set_message (s)
|
||||||
end
|
end
|
||||||
rep_data.send (res)
|
res.send (rep_data)
|
||||||
rep_data.recycle
|
rep_data.recycle
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WSF_SERVICE
|
WSF_SERVICE
|
||||||
|
|
||||||
--inherit
|
|
||||||
-- WGI_SERVICE
|
|
||||||
-- rename
|
|
||||||
-- execute as wgi_execute
|
|
||||||
-- end
|
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
@@ -26,25 +20,13 @@ feature -- Execution
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
--feature {WGI_CONNECTOR} -- WGI Execution
|
feature -- Conversion
|
||||||
|
|
||||||
-- wgi_execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
to_wgi_service: WGI_SERVICE
|
||||||
-- local
|
-- Adapt Current WSF Service to plug into WGI component
|
||||||
-- w_res: detachable WSF_RESPONSE
|
do
|
||||||
-- w_req: detachable WSF_REQUEST
|
create {WSF_TO_WGI_SERVICE} Result.make_from_service (Current)
|
||||||
-- do
|
end
|
||||||
-- 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
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
|||||||
@@ -35,12 +35,10 @@ feature {NONE} -- Events
|
|||||||
app: NINO_SERVICE
|
app: NINO_SERVICE
|
||||||
wt: WORKER_THREAD
|
wt: WORKER_THREAD
|
||||||
e: EXECUTION_ENVIRONMENT
|
e: EXECUTION_ENVIRONMENT
|
||||||
w2w: WSF_TO_WGI_SERVICE
|
|
||||||
do
|
do
|
||||||
port_number := 0
|
port_number := 0
|
||||||
base_url := "test/"
|
base_url := "test/"
|
||||||
create w2w.make_from_service (Current)
|
create app.make_custom (to_wgi_service, base_url)
|
||||||
create app.make_custom (w2w, base_url)
|
|
||||||
web_app := app
|
web_app := app
|
||||||
|
|
||||||
create wt.make (agent app.listen (port_number))
|
create wt.make (agent app.listen (port_number))
|
||||||
|
|||||||
Reference in New Issue
Block a user