From 482f8e41e74b7de451952f2d3c1987ec45439b2b Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 20 Mar 2012 11:40:13 +0100 Subject: [PATCH] Added WSF_SERVICE.to_wgi_service to ease direct integration with existing WGI components --- .../src/gateway/cgi/rest_service_gateway.e | 2 +- .../src/gateway/nino/rest_service_gateway.e | 2 +- .../tests/src/handler/app_request_helper.e | 2 +- library/server/wsf/src/service/wsf_service.e | 30 ++++--------------- .../server/wsf/tests/src/test_wsf_request.e | 4 +-- 5 files changed, 10 insertions(+), 30 deletions(-) diff --git a/draft/library/server/request/rest/tests/src/gateway/cgi/rest_service_gateway.e b/draft/library/server/request/rest/tests/src/gateway/cgi/rest_service_gateway.e index ad30f164..1d09741e 100644 --- a/draft/library/server/request/rest/tests/src/gateway/cgi/rest_service_gateway.e +++ b/draft/library/server/request/rest/tests/src/gateway/cgi/rest_service_gateway.e @@ -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 diff --git a/draft/library/server/request/rest/tests/src/gateway/nino/rest_service_gateway.e b/draft/library/server/request/rest/tests/src/gateway/nino/rest_service_gateway.e index c83eec29..39b32f2e 100644 --- a/draft/library/server/request/rest/tests/src/gateway/nino/rest_service_gateway.e +++ b/draft/library/server/request/rest/tests/src/gateway/nino/rest_service_gateway.e @@ -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) diff --git a/draft/library/server/request/rest/tests/src/handler/app_request_helper.e b/draft/library/server/request/rest/tests/src/handler/app_request_helper.e index 294fc910..569f9eec 100644 --- a/draft/library/server/request/rest/tests/src/handler/app_request_helper.e +++ b/draft/library/server/request/rest/tests/src/handler/app_request_helper.e @@ -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 diff --git a/library/server/wsf/src/service/wsf_service.e b/library/server/wsf/src/service/wsf_service.e index 0f6f2b99..4caee879 100644 --- a/library/server/wsf/src/service/wsf_service.e +++ b/library/server/wsf/src/service/wsf_service.e @@ -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" diff --git a/library/server/wsf/tests/src/test_wsf_request.e b/library/server/wsf/tests/src/test_wsf_request.e index 217000cb..9c421883 100644 --- a/library/server/wsf/tests/src/test_wsf_request.e +++ b/library/server/wsf/tests/src/test_wsf_request.e @@ -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))