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:
@@ -18,12 +18,20 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="debug_any" extends="common">
|
<target name="debug_any" extends="common">
|
||||||
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
||||||
|
<setting name="concurrency" value="scoop"/>
|
||||||
<library name="cgi" location="..\..\library\server\wsf\connector\cgi-safe.ecf" readonly="false"/>
|
<library name="cgi" location="..\..\library\server\wsf\connector\cgi-safe.ecf" readonly="false"/>
|
||||||
<library name="libfcgi" location="..\..\library\server\wsf\connector\libfcgi-safe.ecf"/>
|
<library name="httpd" location="..\..\library\server\wsf\connector\httpd-safe.ecf" readonly="false"/>
|
||||||
<library name="nino" location="..\..\library\server\wsf\connector\nino-safe.ecf"/>
|
<library name="libfcgi" location="..\..\library\server\wsf\connector\libfcgi-safe.ecf" readonly="false"/>
|
||||||
|
<library name="nino" location="..\..\library\server\wsf\connector\nino-safe.ecf" readonly="false"/>
|
||||||
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
|
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="debug_httpd" extends="common">
|
||||||
|
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
||||||
|
<library name="default_httpd" location="..\..\library\server\wsf\default\httpd-safe.ecf" readonly="false"/>
|
||||||
|
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||||
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
|
</target>
|
||||||
<target name="debug_nino" extends="common">
|
<target name="debug_nino" extends="common">
|
||||||
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
||||||
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf"/>
|
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||||
@@ -32,7 +40,7 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="debug_cgi" extends="common">
|
<target name="debug_cgi" extends="common">
|
||||||
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
|
||||||
<library name="default_cgi" location="..\..\library\server\wsf\default\cgi-safe.ecf"/>
|
<library name="default_cgi" location="..\..\library\server\wsf\default\cgi-safe.ecf" readonly="false"/>
|
||||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||||
<cluster name="src" location=".\src\" recursive="true"/>
|
<cluster name="src" location=".\src\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ note
|
|||||||
revision: "$Revision: 36 $"
|
revision: "$Revision: 36 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
APPLICATION_LAUNCHER
|
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
APPLICATION_LAUNCHER_I
|
APPLICATION_LAUNCHER_I [G]
|
||||||
|
|
||||||
feature -- Custom
|
feature -- Custom
|
||||||
|
|
||||||
|
|||||||
@@ -10,24 +10,26 @@ note
|
|||||||
revision: "$Revision: 36 $"
|
revision: "$Revision: 36 $"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
APPLICATION_LAUNCHER_I
|
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
SHARED_EXECUTION_ENVIRONMENT
|
SHARED_EXECUTION_ENVIRONMENT
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
nature: like launcher_nature
|
nature: like launcher_nature
|
||||||
do
|
do
|
||||||
nature := launcher_nature
|
nature := launcher_nature
|
||||||
if nature = Void or else nature = nature_nino then
|
if nature = Void or else nature = nature_httpd then
|
||||||
launch_nino (a_service, opts)
|
launch_httpd (opts)
|
||||||
|
elseif nature = nature_nino then
|
||||||
|
launch_nino (opts)
|
||||||
elseif nature = nature_cgi then
|
elseif nature = nature_cgi then
|
||||||
launch_cgi (a_service, opts)
|
launch_cgi (opts)
|
||||||
elseif nature = nature_libfcgi then
|
elseif nature = nature_libfcgi then
|
||||||
launch_libfcgi (a_service, opts)
|
launch_libfcgi (opts)
|
||||||
else
|
else
|
||||||
-- bye bye
|
-- bye bye
|
||||||
(create {EXCEPTIONS}).die (-1)
|
(create {EXCEPTIONS}).die (-1)
|
||||||
@@ -43,7 +45,6 @@ feature {NONE} -- Access
|
|||||||
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
|
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
|
||||||
local
|
local
|
||||||
p: PATH
|
p: PATH
|
||||||
l_entry_name: READABLE_STRING_32
|
|
||||||
ext: detachable READABLE_STRING_32
|
ext: detachable READABLE_STRING_32
|
||||||
do
|
do
|
||||||
create p.make_from_string (execution_environment.arguments.command_name)
|
create p.make_from_string (execution_environment.arguments.command_name)
|
||||||
@@ -51,6 +52,9 @@ feature {NONE} -- Access
|
|||||||
ext := l_entry.extension
|
ext := l_entry.extension
|
||||||
end
|
end
|
||||||
if ext /= Void then
|
if ext /= Void then
|
||||||
|
if ext.same_string (nature_httpd) then
|
||||||
|
Result := nature_httpd
|
||||||
|
end
|
||||||
if ext.same_string (nature_nino) then
|
if ext.same_string (nature_nino) then
|
||||||
Result := nature_nino
|
Result := nature_nino
|
||||||
end
|
end
|
||||||
@@ -61,39 +65,51 @@ feature {NONE} -- Access
|
|||||||
Result := nature_libfcgi
|
Result := nature_libfcgi
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Result := nature_httpd
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- nino
|
||||||
|
|
||||||
|
nature_httpd: STRING = "httpd"
|
||||||
|
|
||||||
|
launch_httpd (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
|
local
|
||||||
|
launcher: WSF_HTTPD_SERVICE_LAUNCHER [G]
|
||||||
|
do
|
||||||
|
create launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- nino
|
feature {NONE} -- nino
|
||||||
|
|
||||||
nature_nino: STRING = "nino"
|
nature_nino: STRING = "nino"
|
||||||
|
|
||||||
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
launcher: WSF_NINO_SERVICE_LAUNCHER
|
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
|
||||||
do
|
do
|
||||||
create launcher.make_and_launch (a_service, opts)
|
create launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- cgi
|
feature {NONE} -- cgi
|
||||||
|
|
||||||
nature_cgi: STRING = "cgi"
|
nature_cgi: STRING = "cgi"
|
||||||
|
|
||||||
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
launcher: WSF_CGI_SERVICE_LAUNCHER
|
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
|
||||||
do
|
do
|
||||||
create launcher.make_and_launch (a_service, opts)
|
create launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- libfcgi
|
feature {NONE} -- libfcgi
|
||||||
|
|
||||||
nature_libfcgi: STRING = "libfcgi"
|
nature_libfcgi: STRING = "libfcgi"
|
||||||
|
|
||||||
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
|
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
|
||||||
do
|
do
|
||||||
create launcher.make_and_launch (a_service, opts)
|
create launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ note
|
|||||||
revision: "$Revision: 36 $"
|
revision: "$Revision: 36 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
APPLICATION_LAUNCHER
|
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
APPLICATION_LAUNCHER_I
|
APPLICATION_LAUNCHER_I [G]
|
||||||
|
|
||||||
feature -- Custom
|
feature -- Custom
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ note
|
|||||||
revision: "$Revision: 36 $"
|
revision: "$Revision: 36 $"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
APPLICATION_LAUNCHER_I
|
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
launcher: WSF_SERVICE_LAUNCHER
|
launcher: WSF_SERVICE_LAUNCHER [G]
|
||||||
do
|
do
|
||||||
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
|
create {WSF_DEFAULT_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
27
examples/debug/src/ewf_debug_execution.e
Normal file
27
examples/debug/src/ewf_debug_execution.e
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {EWF_DEBUG_EXECUTION}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
EWF_DEBUG_EXECUTION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_EXECUTION
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature -- Execution
|
||||||
|
|
||||||
|
execute
|
||||||
|
local
|
||||||
|
dbg: WSF_DEBUG_HANDLER
|
||||||
|
do
|
||||||
|
response.put_error ("DEBUG uri=" + request.request_uri + "%N")
|
||||||
|
create dbg.make
|
||||||
|
dbg.execute_starts_with ("", request, response)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -14,7 +14,7 @@ inherit
|
|||||||
initialize
|
initialize
|
||||||
end
|
end
|
||||||
|
|
||||||
APPLICATION_LAUNCHER
|
APPLICATION_LAUNCHER [EWF_DEBUG_EXECUTION]
|
||||||
|
|
||||||
create
|
create
|
||||||
make_and_launch
|
make_and_launch
|
||||||
@@ -30,14 +30,14 @@ feature {NONE} -- Initialization
|
|||||||
-- set_service_option ("base", "/www-debug/debug_service.fcgi/")
|
-- set_service_option ("base", "/www-debug/debug_service.fcgi/")
|
||||||
end
|
end
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
-- execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
-- local
|
||||||
dbg: WSF_DEBUG_HANDLER
|
-- dbg: WSF_DEBUG_HANDLER
|
||||||
do
|
-- do
|
||||||
res.put_error ("DEBUG" + req.request_uri + "%N")
|
-- res.put_error ("OH NO uri=" + req.request_uri + "%N")
|
||||||
create dbg.make
|
-- create dbg.make
|
||||||
dbg.execute_starts_with ("", req, res)
|
-- dbg.execute_starts_with ("", req, res)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
|
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
|
||||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>
|
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="simple_httpd" extends="common">
|
||||||
|
<root class="APPLICATION" feature="make_and_launch"/>
|
||||||
|
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
|
</option>
|
||||||
|
<library name="default_httpd" location="..\..\library\server\wsf\default\httpd-safe.ecf"/>
|
||||||
|
<cluster name="simple" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
<target name="simple_nino" extends="common">
|
<target name="simple_nino" extends="common">
|
||||||
<root class="APPLICATION" feature="make_and_launch"/>
|
<root class="APPLICATION" feature="make_and_launch"/>
|
||||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
Eiffel REST services
|
<title>EWF simple_file example</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
Welcome to the Eiffel REST services site, here you will find a lot of <br/>
|
<h1>EWF simple_file example</h1>
|
||||||
resources about REST and our solution
|
This is a static html file served by EWF.
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -7,18 +7,20 @@ class
|
|||||||
SERVICE_FILE
|
SERVICE_FILE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_DEFAULT_SERVICE
|
WSF_DEFAULT_SERVICE [SERVICE_FILE_EXECUTION]
|
||||||
|
redefine
|
||||||
|
initialize
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make_and_launch
|
make_and_launch
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
initialize
|
||||||
local
|
|
||||||
f: WSF_FILE_RESPONSE
|
|
||||||
do
|
do
|
||||||
create f.make_html ("home.html")
|
Precursor
|
||||||
res.send (f)
|
set_service_option ("port", 9090)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="connector_nino" location="..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf"/>
|
<library name="connector_httpd" location="..\..\library\server\ewsgi\connectors\httpd\httpd-safe.ecf"/>
|
||||||
<library name="default_nino" location="..\..\library\server\wsf\default\nino-safe.ecf"/>
|
<library name="default_httpd" location="..\..\library\server\wsf\default\httpd-safe.ecf"/>
|
||||||
<library name="http" location="../../library/network/protocol/http/http-safe.ecf"/>
|
<library name="http" location="../../library/network/protocol/http/http-safe.ecf"/>
|
||||||
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>
|
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>
|
||||||
<cluster name="service_file" location=".\" recursive="true">
|
<cluster name="service_file" location=".\" recursive="true">
|
||||||
|
|||||||
26
examples/simple_file/service_file_execution.e
Normal file
26
examples/simple_file/service_file_execution.e
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {SERVICE_FILE_EXECUTION}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
SERVICE_FILE_EXECUTION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_EXECUTION
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
execute
|
||||||
|
local
|
||||||
|
f: WSF_FILE_RESPONSE
|
||||||
|
do
|
||||||
|
create f.make_html ("home.html")
|
||||||
|
response.send (f)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -4,21 +4,11 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WGI_CGI_CONNECTOR
|
WGI_CGI_CONNECTOR [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_CONNECTOR
|
WGI_CONNECTOR
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make (a_service: like service)
|
|
||||||
do
|
|
||||||
service := a_service
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
Name: STRING_8 = "CGI"
|
Name: STRING_8 = "CGI"
|
||||||
@@ -27,24 +17,23 @@ feature -- Access
|
|||||||
Version: STRING_8 = "0.1"
|
Version: STRING_8 = "0.1"
|
||||||
-- Version of Current connector
|
-- Version of Current connector
|
||||||
|
|
||||||
feature {NONE} -- Access
|
|
||||||
|
|
||||||
service: WGI_SERVICE
|
|
||||||
-- Gateway Service
|
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
launch
|
launch
|
||||||
local
|
local
|
||||||
req: WGI_REQUEST_FROM_TABLE
|
req: WGI_REQUEST_FROM_TABLE
|
||||||
res: detachable WGI_RESPONSE_STREAM
|
res: detachable WGI_RESPONSE_STREAM
|
||||||
|
exec: detachable WGI_EXECUTION
|
||||||
rescued: BOOLEAN
|
rescued: BOOLEAN
|
||||||
do
|
do
|
||||||
if not rescued then
|
if not rescued then
|
||||||
create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_CGI_INPUT_STREAM}.make, Current)
|
create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_CGI_INPUT_STREAM}.make, Current)
|
||||||
create res.make (create {WGI_CGI_OUTPUT_STREAM}.make, create {WGI_CGI_ERROR_STREAM}.make)
|
create res.make (create {WGI_CGI_OUTPUT_STREAM}.make, create {WGI_CGI_ERROR_STREAM}.make)
|
||||||
service.execute (req, res)
|
create {G} exec.make (req, res)
|
||||||
|
exec.execute
|
||||||
|
res.flush
|
||||||
res.push
|
res.push
|
||||||
|
exec.clean
|
||||||
else
|
else
|
||||||
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
||||||
if res /= Void then
|
if res /= Void then
|
||||||
@@ -59,6 +48,9 @@ feature -- Execution
|
|||||||
res.push
|
res.push
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if exec /= Void then
|
||||||
|
exec.clean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
if not rescued then
|
if not rescued then
|
||||||
|
|||||||
@@ -17,33 +17,16 @@ feature {NONE} -- Initialization
|
|||||||
make
|
make
|
||||||
-- Initialize `Current'.
|
-- Initialize `Current'.
|
||||||
local
|
local
|
||||||
server: separate HTTPD_SERVER
|
conn: WGI_HTTPD_CONNECTOR [APP_WSF_EXECUTION]
|
||||||
fac: separate WSF_HTTPD_REQUEST_HANDLER_FACTORY [APP_WSF_EXECUTION]
|
|
||||||
do
|
do
|
||||||
print ("Hello%N")
|
print ("Starting httpd server ...%N")
|
||||||
create fac
|
|
||||||
create server.make (fac)
|
create conn.make
|
||||||
launch_server (server)
|
conn.set_port_number (9090)
|
||||||
|
conn.set_max_concurrent_connections (100)
|
||||||
|
conn.launch
|
||||||
end
|
end
|
||||||
|
|
||||||
launch_server (server: separate HTTPD_SERVER)
|
|
||||||
do
|
|
||||||
server.configuration.set_max_concurrent_connections (100)
|
|
||||||
server.configuration.set_http_server_port (9090)
|
|
||||||
server.launch
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Status
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
feature -- Change
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
|
||||||
invariant
|
|
||||||
-- invariant_clause: True
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
<exclude>/\.git$</exclude>
|
<exclude>/\.git$</exclude>
|
||||||
<exclude>/\.svn$</exclude>
|
<exclude>/\.svn$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<option debug="true" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
<option debug="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||||
<debug name="dbglog" enabled="true"/>
|
<debug name="dbglog" enabled="true"/>
|
||||||
|
<assertions precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<setting name="concurrency" value="scoop"/>
|
<setting name="concurrency" value="scoop"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
@@ -31,13 +32,12 @@
|
|||||||
</condition>
|
</condition>
|
||||||
</library>
|
</library>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf" readonly="false"/>
|
|
||||||
<cluster name="httpd_server" location=".\src\httpd\" recursive="true">
|
<cluster name="httpd_server" location=".\src\httpd\" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/concurrency$</exclude>
|
<exclude>/ssl$</exclude>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/no_ssl$</exclude>
|
<exclude>/no_ssl$</exclude>
|
||||||
<exclude>/ssl$</exclude>
|
<exclude>/concurrency$</exclude>
|
||||||
</file_rule>
|
</file_rule>
|
||||||
<cluster name="no_ssl" location="$|no_ssl\" recursive="true">
|
<cluster name="no_ssl" location="$|no_ssl\" recursive="true">
|
||||||
<condition>
|
<condition>
|
||||||
@@ -73,11 +73,12 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="dev" extends="connector_httpd">
|
<target name="dev" extends="connector_httpd">
|
||||||
<root class="HTTPD_CONNECTOR_DEV" feature="make"/>
|
<root class="HTTPD_CONNECTOR_DEV" feature="make"/>
|
||||||
<option debug="true">
|
<option debug="false">
|
||||||
<debug name="dbglog" enabled="true"/>
|
<debug name="dbglog" enabled="true"/>
|
||||||
<assertions precondition="true" postcondition="true" check="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" supplier_precondition="true"/>
|
||||||
</option>
|
</option>
|
||||||
<setting name="concurrency" value="scoop"/>
|
<setting name="concurrency" value="scoop"/>
|
||||||
|
<library name="wsf" location="..\..\..\wsf\wsf-safe.ecf" readonly="false"/>
|
||||||
<cluster name="dev" location="dev\" recursive="true"/>
|
<cluster name="dev" location="dev\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
<target name="dev_mt" extends="dev">
|
<target name="dev_mt" extends="dev">
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ feature -- Execution
|
|||||||
cl := h.client_socket
|
cl := h.client_socket
|
||||||
a_listening_socket.accept_to (cl)
|
a_listening_socket.accept_to (cl)
|
||||||
if h.is_connected then
|
if h.is_connected then
|
||||||
h.execute
|
h.safe_execute
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
check is_not_full: False end
|
check is_not_full: False end
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ feature {NONE} -- Initialization
|
|||||||
make (a_factory: like factory)
|
make (a_factory: like factory)
|
||||||
-- `a_cfg': server configuration
|
-- `a_cfg': server configuration
|
||||||
-- `a_factory': connection handler builder
|
-- `a_factory': connection handler builder
|
||||||
|
require
|
||||||
|
fac_is_separated: {PLATFORM}.is_scoop_capable implies not attached {HTTPD_REQUEST_HANDLER_FACTORY} a_factory
|
||||||
do
|
do
|
||||||
make_configured (create {like configuration}.make, a_factory)
|
make_configured (create {like configuration}.make, a_factory)
|
||||||
end
|
end
|
||||||
|
|||||||
183
library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e
Normal file
183
library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WGI_HTTPD_CONNECTOR}."
|
||||||
|
author: ""
|
||||||
|
todo: "[
|
||||||
|
Check if server and configuration has to be 'separate' ?
|
||||||
|
currently yes, due to WGI_REQUEST.wgi_connector setting.
|
||||||
|
But we may get rid of this one...
|
||||||
|
See `{WGI_REQUEST}.wgi_connector' and `{WSF_REQUEST}.wgi_connector' ...
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WGI_HTTPD_CONNECTOR [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WGI_CONNECTOR
|
||||||
|
|
||||||
|
create
|
||||||
|
make,
|
||||||
|
make_with_base
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
local
|
||||||
|
fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G]
|
||||||
|
do
|
||||||
|
-- Callbacks
|
||||||
|
create on_launched_actions
|
||||||
|
create on_stopped_actions
|
||||||
|
|
||||||
|
-- Server
|
||||||
|
create fac
|
||||||
|
create server.make (fac)
|
||||||
|
configuration := server_configuration (server)
|
||||||
|
|
||||||
|
set_factory_connector (Current, fac)
|
||||||
|
end
|
||||||
|
|
||||||
|
make_with_base (a_base: like base)
|
||||||
|
require
|
||||||
|
a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/")
|
||||||
|
do
|
||||||
|
make
|
||||||
|
set_base (a_base)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_factory_connector (conn: detachable separate WGI_CONNECTOR; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G])
|
||||||
|
do
|
||||||
|
fac.set_connector (conn)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
name: STRING_8 = "httpd"
|
||||||
|
-- Name of Current connector
|
||||||
|
|
||||||
|
version: STRING_8 = "0.1"
|
||||||
|
-- Version of Current connector
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
server: separate HTTPD_SERVER
|
||||||
|
|
||||||
|
configuration: separate HTTPD_CONFIGURATION
|
||||||
|
|
||||||
|
server_configuration (a_server: like server): like configuration
|
||||||
|
do
|
||||||
|
Result := a_server.configuration
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
base: detachable READABLE_STRING_8
|
||||||
|
-- Root url base
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
launched: BOOLEAN
|
||||||
|
-- Server launched and listening on `port'
|
||||||
|
|
||||||
|
port: INTEGER
|
||||||
|
-- Listening port.
|
||||||
|
--| 0: not launched
|
||||||
|
|
||||||
|
feature -- Callbacks
|
||||||
|
|
||||||
|
on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||||
|
-- Actions triggered when launched
|
||||||
|
|
||||||
|
on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||||
|
-- Actions triggered when stopped
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
on_launched (a_port: INTEGER)
|
||||||
|
-- Server launched
|
||||||
|
do
|
||||||
|
launched := True
|
||||||
|
port := a_port
|
||||||
|
on_launched_actions.call ([Current])
|
||||||
|
end
|
||||||
|
|
||||||
|
on_stopped
|
||||||
|
-- Server stopped
|
||||||
|
do
|
||||||
|
on_stopped_actions.call ([Current])
|
||||||
|
launched := False
|
||||||
|
port := 0
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
set_base (b: like base)
|
||||||
|
require
|
||||||
|
b_starts_with_slash: (b /= Void and then not b.is_empty) implies b.starts_with ("/")
|
||||||
|
do
|
||||||
|
base := b
|
||||||
|
ensure
|
||||||
|
valid_base: (attached base as l_base and then not l_base.is_empty) implies l_base.starts_with ("/")
|
||||||
|
end
|
||||||
|
|
||||||
|
set_port_number (a_port_number: INTEGER)
|
||||||
|
require
|
||||||
|
a_port_number_positive_or_zero: a_port_number >= 0
|
||||||
|
do
|
||||||
|
set_port_on_configuration (a_port_number, configuration)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_max_concurrent_connections (nb: INTEGER)
|
||||||
|
do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
set_port_on_configuration (a_port_number: INTEGER; cfg: like configuration)
|
||||||
|
do
|
||||||
|
cfg.set_http_server_port (a_port_number)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_max_concurrent_connections_on_configuration (nb: INTEGER; cfg: like configuration)
|
||||||
|
do
|
||||||
|
cfg.set_max_concurrent_connections (nb)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Server
|
||||||
|
|
||||||
|
launch
|
||||||
|
do
|
||||||
|
launched := False
|
||||||
|
port := 0
|
||||||
|
launch_server (server)
|
||||||
|
end
|
||||||
|
|
||||||
|
configure_server (a_configuration: like configuration)
|
||||||
|
do
|
||||||
|
if a_configuration.is_verbose then
|
||||||
|
if attached base as l_base then
|
||||||
|
io.error.put_string ("Base=" + l_base + "%N")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
launch_server (a_server: like server)
|
||||||
|
do
|
||||||
|
configure_server (a_server.configuration)
|
||||||
|
a_server.launch
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
end
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
|||||||
set_source (a_source)
|
set_source (a_source)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WGI_NINO_CONNECTOR, WGI_SERVICE} -- Nino
|
feature {WGI_HTTPD_CONNECTOR, WGI_SERVICE} -- Nino
|
||||||
|
|
||||||
set_source (i: like source)
|
set_source (i: like source)
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
|
|||||||
set_target (a_target)
|
set_target (a_target)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WGI_NINO_CONNECTOR, WGI_SERVICE} -- Nino
|
feature {WGI_HTTPD_CONNECTOR, WGI_SERVICE} -- Nino
|
||||||
|
|
||||||
set_target (o: like target)
|
set_target (o: like target)
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_HTTPD_REQUEST_HANDLER}."
|
description: "Summary description for {WGI_HTTPD_REQUEST_HANDLER}."
|
||||||
author: ""
|
author: ""
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_HTTPD_REQUEST_HANDLER [G -> WSF_EXECUTION create make end]
|
WGI_HTTPD_REQUEST_HANDLER [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
HTTPD_REQUEST_HANDLER
|
HTTPD_REQUEST_HANDLER
|
||||||
@@ -15,7 +15,18 @@ inherit
|
|||||||
REFACTORING_HELPER
|
REFACTORING_HELPER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make,
|
||||||
|
make_with_connector
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make_with_connector (conn: like connector)
|
||||||
|
do
|
||||||
|
make
|
||||||
|
connector := conn
|
||||||
|
end
|
||||||
|
|
||||||
|
connector: detachable separate WGI_CONNECTOR
|
||||||
|
|
||||||
feature -- Request processing
|
feature -- Request processing
|
||||||
|
|
||||||
@@ -27,8 +38,7 @@ feature -- Request processing
|
|||||||
l_error: WGI_ERROR_STREAM
|
l_error: WGI_ERROR_STREAM
|
||||||
req: WGI_REQUEST_FROM_TABLE
|
req: WGI_REQUEST_FROM_TABLE
|
||||||
res: detachable WGI_HTTPD_RESPONSE_STREAM
|
res: detachable WGI_HTTPD_RESPONSE_STREAM
|
||||||
|
exec: detachable WGI_EXECUTION
|
||||||
exec: WSF_EXECUTION
|
|
||||||
retried: BOOLEAN
|
retried: BOOLEAN
|
||||||
do
|
do
|
||||||
if not retried then
|
if not retried then
|
||||||
@@ -36,15 +46,33 @@ feature -- Request processing
|
|||||||
create {WGI_HTTPD_OUTPUT_STREAM} l_output.make (a_socket)
|
create {WGI_HTTPD_OUTPUT_STREAM} l_output.make (a_socket)
|
||||||
create {WGI_HTTPD_ERROR_STREAM} l_error.make_stderr (a_socket.descriptor.out)
|
create {WGI_HTTPD_ERROR_STREAM} l_error.make_stderr (a_socket.descriptor.out)
|
||||||
|
|
||||||
create req.make (httpd_environment (a_socket), l_input, Void)
|
create req.make (httpd_environment (a_socket), l_input, connector)
|
||||||
create res.make (l_output, l_error)
|
create res.make (l_output, l_error)
|
||||||
|
|
||||||
req.set_meta_string_variable ("RAW_HEADER_DATA", request_header)
|
req.set_meta_string_variable ("RAW_HEADER_DATA", request_header)
|
||||||
|
|
||||||
exec := new_execution (req, res)
|
create {G} exec.make (req, res)
|
||||||
exec.execute
|
exec.execute
|
||||||
|
res.flush
|
||||||
res.push
|
res.push
|
||||||
|
exec.clean
|
||||||
else
|
else
|
||||||
|
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
||||||
|
if res /= Void then
|
||||||
|
if not res.status_is_set then
|
||||||
|
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||||
|
end
|
||||||
|
if res.message_writable then
|
||||||
|
res.put_string ("<pre>")
|
||||||
|
res.put_string (l_trace)
|
||||||
|
res.put_string ("</pre>")
|
||||||
|
end
|
||||||
|
res.push
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if exec /= Void then
|
||||||
|
exec.clean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
if not retried then
|
if not retried then
|
||||||
@@ -53,11 +81,6 @@ feature -- Request processing
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
new_execution (req: WGI_REQUEST; res: WGI_RESPONSE): WSF_EXECUTION
|
|
||||||
do
|
|
||||||
create {G} Result.make (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
base: detachable READABLE_STRING_8
|
base: detachable READABLE_STRING_8
|
||||||
do
|
do
|
||||||
--TODO
|
--TODO
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WGI_HTTPD_REQUEST_HANDLER_FACTORY}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WGI_HTTPD_REQUEST_HANDLER_FACTORY [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
|
inherit
|
||||||
|
HTTPD_REQUEST_HANDLER_FACTORY
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
connector: detachable separate WGI_CONNECTOR
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
set_connector (conn: like connector)
|
||||||
|
do
|
||||||
|
connector := conn
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Factory
|
||||||
|
|
||||||
|
new_handler: separate WGI_HTTPD_REQUEST_HANDLER [G]
|
||||||
|
do
|
||||||
|
create Result.make_with_connector (connector)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
end
|
||||||
@@ -6,19 +6,19 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WGI_LIBFCGI_CONNECTOR
|
WGI_LIBFCGI_CONNECTOR [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_CONNECTOR
|
WGI_CONNECTOR
|
||||||
|
redefine
|
||||||
create
|
default_create
|
||||||
make
|
end
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_service: like service)
|
default_create
|
||||||
do
|
do
|
||||||
service := a_service
|
Precursor
|
||||||
create fcgi.make
|
create fcgi.make
|
||||||
create input.make (fcgi)
|
create input.make (fcgi)
|
||||||
create output.make (fcgi)
|
create output.make (fcgi)
|
||||||
@@ -32,11 +32,6 @@ feature -- Access
|
|||||||
Version: STRING_8 = "0.1"
|
Version: STRING_8 = "0.1"
|
||||||
-- Version of Current connector
|
-- Version of Current connector
|
||||||
|
|
||||||
feature {NONE} -- Access
|
|
||||||
|
|
||||||
service: WGI_SERVICE
|
|
||||||
-- Gateway Service
|
|
||||||
|
|
||||||
feature -- Server
|
feature -- Server
|
||||||
|
|
||||||
launch
|
launch
|
||||||
@@ -59,14 +54,18 @@ feature -- Execution
|
|||||||
local
|
local
|
||||||
req: WGI_REQUEST_FROM_TABLE
|
req: WGI_REQUEST_FROM_TABLE
|
||||||
res: detachable WGI_RESPONSE_STREAM
|
res: detachable WGI_RESPONSE_STREAM
|
||||||
|
exec: detachable WGI_EXECUTION
|
||||||
rescued: BOOLEAN
|
rescued: BOOLEAN
|
||||||
do
|
do
|
||||||
if not rescued then
|
if not rescued then
|
||||||
a_input.reset
|
a_input.reset
|
||||||
create req.make (vars, a_input, Current)
|
create req.make (vars, a_input, Current)
|
||||||
create res.make (a_output, a_output)
|
create res.make (a_output, a_output)
|
||||||
service.execute (req, res)
|
create {G} exec.make (req, res)
|
||||||
|
exec.execute
|
||||||
|
res.flush
|
||||||
res.push
|
res.push
|
||||||
|
exec.clean
|
||||||
else
|
else
|
||||||
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
||||||
if res /= Void then
|
if res /= Void then
|
||||||
@@ -81,6 +80,9 @@ feature -- Execution
|
|||||||
res.push
|
res.push
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if exec /= Void then
|
||||||
|
exec.clean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
if not rescued then
|
if not rescued then
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WGI_NINO_CONNECTOR
|
WGI_NINO_CONNECTOR [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WGI_CONNECTOR
|
WGI_CONNECTOR
|
||||||
@@ -118,7 +118,7 @@ feature -- Server
|
|||||||
do
|
do
|
||||||
launched := False
|
launched := False
|
||||||
port := 0
|
port := 0
|
||||||
create {WGI_NINO_HANDLER} l_http_handler.make_with_callback (server, Current)
|
create {WGI_NINO_HANDLER [G]} l_http_handler.make_with_callback (server, Current)
|
||||||
if configuration.is_verbose then
|
if configuration.is_verbose then
|
||||||
if attached base as l_base then
|
if attached base as l_base then
|
||||||
io.error.put_string ("Base=" + l_base + "%N")
|
io.error.put_string ("Base=" + l_base + "%N")
|
||||||
@@ -128,17 +128,40 @@ feature -- Server
|
|||||||
end
|
end
|
||||||
|
|
||||||
process_request (env: STRING_TABLE [READABLE_STRING_8]; a_headers_text: STRING; a_socket: TCP_STREAM_SOCKET)
|
process_request (env: STRING_TABLE [READABLE_STRING_8]; a_headers_text: STRING; a_socket: TCP_STREAM_SOCKET)
|
||||||
|
-- Process request ...
|
||||||
local
|
local
|
||||||
req: WGI_REQUEST_FROM_TABLE
|
req: WGI_REQUEST_FROM_TABLE
|
||||||
res: detachable WGI_NINO_RESPONSE_STREAM
|
res: detachable WGI_NINO_RESPONSE_STREAM
|
||||||
|
exec: detachable WGI_EXECUTION
|
||||||
retried: BOOLEAN
|
retried: BOOLEAN
|
||||||
do
|
do
|
||||||
if not retried then
|
if not retried then
|
||||||
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current)
|
create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_socket), Current)
|
||||||
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), create {WGI_NINO_ERROR_STREAM}.make_stderr (a_socket.descriptor.out))
|
create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_socket), create {WGI_NINO_ERROR_STREAM}.make_stderr (a_socket.descriptor.out))
|
||||||
req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text)
|
req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text)
|
||||||
service.execute (req, res)
|
|
||||||
|
create {G} exec.make (req, res)
|
||||||
|
exec.execute
|
||||||
|
res.flush
|
||||||
res.push
|
res.push
|
||||||
|
exec.clean
|
||||||
|
else
|
||||||
|
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then
|
||||||
|
if res /= Void then
|
||||||
|
if not res.status_is_set then
|
||||||
|
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||||
|
end
|
||||||
|
if res.message_writable then
|
||||||
|
res.put_string ("<pre>")
|
||||||
|
res.put_string (l_trace)
|
||||||
|
res.put_string ("</pre>")
|
||||||
|
end
|
||||||
|
res.push
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if exec /= Void then
|
||||||
|
exec.clean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
if not retried then
|
if not retried then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ note
|
|||||||
revision : "$Revision$"
|
revision : "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WGI_NINO_HANDLER
|
WGI_NINO_HANDLER [G -> WGI_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
HTTP_CONNECTION_HANDLER
|
HTTP_CONNECTION_HANDLER
|
||||||
@@ -27,7 +27,7 @@ feature {NONE} -- Initialization
|
|||||||
callback := a_callback
|
callback := a_callback
|
||||||
end
|
end
|
||||||
|
|
||||||
callback: WGI_NINO_CONNECTOR
|
callback: WGI_NINO_CONNECTOR [G]
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ feature -- Eiffel WGI access
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
wgi_connector: detachable WGI_CONNECTOR
|
wgi_connector: detachable separate WGI_CONNECTOR
|
||||||
-- Associated Eiffel WGI connector
|
-- Associated Eiffel WGI connector
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,20 +11,6 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WGI_SERVICE
|
WGI_SERVICE
|
||||||
|
|
||||||
feature {WGI_CONNECTOR} -- Execution
|
|
||||||
|
|
||||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
|
||||||
-- Execute the request
|
|
||||||
-- See `req.input' for input stream
|
|
||||||
-- `req.meta_variables' for the CGI meta variable
|
|
||||||
-- and `res' for output buffer
|
|
||||||
require
|
|
||||||
res_status_unset: not res.status_is_set
|
|
||||||
deferred
|
|
||||||
ensure
|
|
||||||
res_status_set: res.status_is_set
|
|
||||||
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"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ feature -- EWSGI access
|
|||||||
|
|
||||||
wgi_implementation: STRING = "Eiffel Web Framework 0.1"
|
wgi_implementation: STRING = "Eiffel Web Framework 0.1"
|
||||||
|
|
||||||
wgi_connector: detachable WGI_CONNECTOR
|
wgi_connector: detachable separate WGI_CONNECTOR
|
||||||
|
|
||||||
feature -- Access: CGI meta parameters
|
feature -- Access: CGI meta parameters
|
||||||
|
|
||||||
|
|||||||
54
library/server/ewsgi/src/wgi_execution.e
Normal file
54
library/server/ewsgi/src/wgi_execution.e
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WGI_EXECUTION}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
WGI_EXECUTION
|
||||||
|
|
||||||
|
--create
|
||||||
|
-- make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||||
|
do
|
||||||
|
request := req
|
||||||
|
response := res
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Access
|
||||||
|
|
||||||
|
request: WGI_REQUEST
|
||||||
|
|
||||||
|
response: WGI_RESPONSE
|
||||||
|
|
||||||
|
feature -- Execution
|
||||||
|
|
||||||
|
execute
|
||||||
|
-- Execute the request based on `request' and `response'.
|
||||||
|
deferred
|
||||||
|
ensure
|
||||||
|
status_is_set: response.status_is_set
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Cleaning
|
||||||
|
|
||||||
|
clean
|
||||||
|
-- Clean request data.
|
||||||
|
do
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
end
|
||||||
@@ -18,40 +18,36 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_CGI_SERVICE_LAUNCHER
|
WSF_CGI_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_SERVICE_LAUNCHER
|
WSF_SERVICE_LAUNCHER [G]
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_and_launch,
|
make_and_launch
|
||||||
make_callback,
|
|
||||||
make_callback_and_launch
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
do
|
do
|
||||||
create connector.make (Current)
|
create connector
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
launch
|
launch
|
||||||
do
|
do
|
||||||
if attached connector as conn then
|
connector.launch
|
||||||
conn.launch
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
connector: detachable WGI_CGI_CONNECTOR
|
connector: WGI_CGI_CONNECTOR [G]
|
||||||
-- Default service name
|
-- Default service name
|
||||||
|
|
||||||
;note
|
;note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
22
library/server/wsf/connector/httpd-safe.ecf
Normal file
22
library/server/wsf/connector/httpd-safe.ecf
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="wsf_httpd" uuid="9BF2D71A-0986-4025-9C97-15B65F07C568" library_target="wsf_httpd">
|
||||||
|
<target name="wsf_httpd">
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/\.git$</exclude>
|
||||||
|
<exclude>/\.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||||
|
</option>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="connector_httpd" location="..\..\ewsgi\connectors\httpd\httpd-safe.ecf"/>
|
||||||
|
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||||
|
<library name="error" location="..\..\..\utility\general\error\error-safe.ecf"/>
|
||||||
|
<library name="ewsgi" location="..\..\ewsgi\ewsgi-safe.ecf"/>
|
||||||
|
<library name="http" location="..\..\..\network\protocol\http\http-safe.ecf"/>
|
||||||
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
|
<library name="wsf" location="..\wsf-safe.ecf"/>
|
||||||
|
<cluster name="wsf_httpd" location=".\httpd\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
168
library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e
Normal file
168
library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Component to launch the service using the default connector
|
||||||
|
|
||||||
|
Eiffel Web httpd for this class
|
||||||
|
|
||||||
|
|
||||||
|
The httpd default connector support options:
|
||||||
|
port: numeric such as 8099 (or equivalent string as "8099")
|
||||||
|
base: base_url (very specific to standalone server)
|
||||||
|
verbose: to display verbose output, useful for Nino
|
||||||
|
force_single_threaded: use only one thread, useful for Nino
|
||||||
|
|
||||||
|
check WSF_SERVICE_LAUNCHER for more documentation
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WSF_HTTPD_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_SERVICE_LAUNCHER [G]
|
||||||
|
redefine
|
||||||
|
launchable
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
make,
|
||||||
|
make_and_launch
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
initialize
|
||||||
|
local
|
||||||
|
conn: like connector
|
||||||
|
do
|
||||||
|
create on_launched_actions
|
||||||
|
create on_stopped_actions
|
||||||
|
|
||||||
|
port_number := 80 --| Default, but quite often, this port is already used ...
|
||||||
|
base_url := ""
|
||||||
|
|
||||||
|
if attached options as opts then
|
||||||
|
if attached {READABLE_STRING_GENERAL} opts.option ("server_name") as l_server_name then
|
||||||
|
server_name := l_server_name.to_string_8
|
||||||
|
end
|
||||||
|
if attached {INTEGER} opts.option ("port") as l_port then
|
||||||
|
port_number := l_port
|
||||||
|
elseif
|
||||||
|
attached {READABLE_STRING_GENERAL} opts.option ("port") as l_port_str and then
|
||||||
|
l_port_str.is_integer
|
||||||
|
then
|
||||||
|
port_number := l_port_str.as_string_8.to_integer
|
||||||
|
end
|
||||||
|
if attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str then
|
||||||
|
base_url := l_base_str.as_string_8
|
||||||
|
end
|
||||||
|
if attached {BOOLEAN} opts.option ("force_single_threaded") as l_single_threaded then
|
||||||
|
single_threaded := l_single_threaded
|
||||||
|
elseif attached {READABLE_STRING_GENERAL} opts.option ("force_single_threaded") as l_single_threaded_str then
|
||||||
|
single_threaded := l_single_threaded_str.as_lower.same_string ("true")
|
||||||
|
end
|
||||||
|
if attached {BOOLEAN} opts.option ("verbose") as l_verbose then
|
||||||
|
verbose := l_verbose
|
||||||
|
elseif attached {READABLE_STRING_GENERAL} opts.option ("verbose") as l_verbose_str then
|
||||||
|
verbose := l_verbose_str.as_lower.same_string ("true")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
create conn.make
|
||||||
|
connector := conn
|
||||||
|
conn.on_launched_actions.extend (agent on_launched)
|
||||||
|
conn.on_stopped_actions.extend (agent on_stopped)
|
||||||
|
conn.set_base (base_url)
|
||||||
|
|
||||||
|
update_configuration (conn.configuration)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Execution
|
||||||
|
|
||||||
|
update_configuration (cfg: separate HTTPD_CONFIGURATION)
|
||||||
|
do
|
||||||
|
if single_threaded then
|
||||||
|
cfg.set_force_single_threaded (True)
|
||||||
|
end
|
||||||
|
cfg.set_is_verbose (verbose)
|
||||||
|
if attached server_name as l_server_name then
|
||||||
|
cfg.set_http_server_name (l_server_name)
|
||||||
|
end
|
||||||
|
-- conn.set_port_number (port_number)
|
||||||
|
cfg.http_server_port := port_number
|
||||||
|
end
|
||||||
|
|
||||||
|
launch
|
||||||
|
-- <Precursor/>
|
||||||
|
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
||||||
|
local
|
||||||
|
conn: like connector
|
||||||
|
do
|
||||||
|
conn := connector
|
||||||
|
conn.set_base (base_url)
|
||||||
|
debug ("nino")
|
||||||
|
if verbose then
|
||||||
|
io.error.put_string ("Launching Nino web server on port " + port_number.out)
|
||||||
|
if attached server_name as l_name then
|
||||||
|
io.error.put_string ("%N http://" + l_name + ":" + port_number.out + "/" + base_url + "%N")
|
||||||
|
else
|
||||||
|
io.error.put_string ("%N http://localhost:" + port_number.out + "/" + base_url + "%N")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
update_configuration (conn.configuration)
|
||||||
|
conn.launch
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Callback
|
||||||
|
|
||||||
|
on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||||
|
-- Actions triggered when launched
|
||||||
|
|
||||||
|
on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||||
|
-- Actions triggered when stopped
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
on_launched (conn: WGI_CONNECTOR)
|
||||||
|
do
|
||||||
|
on_launched_actions.call ([conn])
|
||||||
|
end
|
||||||
|
|
||||||
|
on_stopped (conn: WGI_CONNECTOR)
|
||||||
|
do
|
||||||
|
on_stopped_actions.call ([conn])
|
||||||
|
end
|
||||||
|
|
||||||
|
port_number: INTEGER
|
||||||
|
|
||||||
|
server_name: detachable READABLE_STRING_8
|
||||||
|
|
||||||
|
base_url: READABLE_STRING_8
|
||||||
|
|
||||||
|
verbose: BOOLEAN
|
||||||
|
|
||||||
|
single_threaded: BOOLEAN
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
connector: WGI_HTTPD_CONNECTOR [G]
|
||||||
|
-- Default connector
|
||||||
|
|
||||||
|
launchable: BOOLEAN
|
||||||
|
do
|
||||||
|
Result := Precursor and port_number >= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
;note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
|
||||||
|
end
|
||||||
@@ -18,40 +18,36 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_LIBFCGI_SERVICE_LAUNCHER
|
WSF_LIBFCGI_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_SERVICE_LAUNCHER
|
WSF_SERVICE_LAUNCHER [G]
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_and_launch,
|
make_and_launch
|
||||||
make_callback,
|
|
||||||
make_callback_and_launch
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
do
|
do
|
||||||
create connector.make (Current)
|
create connector
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
launch
|
launch
|
||||||
do
|
do
|
||||||
if attached connector as conn then
|
connector.launch
|
||||||
conn.launch
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
connector: detachable WGI_LIBFCGI_CONNECTOR
|
connector: WGI_LIBFCGI_CONNECTOR [G]
|
||||||
-- Default service name
|
-- Default service name
|
||||||
|
|
||||||
;note
|
;note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -17,19 +17,17 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_NINO_SERVICE_LAUNCHER
|
WSF_NINO_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_SERVICE_LAUNCHER
|
WSF_SERVICE_LAUNCHER [G]
|
||||||
redefine
|
redefine
|
||||||
launchable
|
launchable
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_and_launch,
|
make_and_launch
|
||||||
make_callback,
|
|
||||||
make_callback_and_launch
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
@@ -70,9 +68,10 @@ feature {NONE} -- Initialization
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
create conn.make (Current)
|
create conn.make (Current)
|
||||||
|
connector := conn
|
||||||
|
|
||||||
conn.on_launched_actions.extend (agent on_launched)
|
conn.on_launched_actions.extend (agent on_launched)
|
||||||
conn.on_stopped_actions.extend (agent on_stopped)
|
conn.on_stopped_actions.extend (agent on_stopped)
|
||||||
connector := conn
|
|
||||||
conn.set_base (base_url)
|
conn.set_base (base_url)
|
||||||
if single_threaded then
|
if single_threaded then
|
||||||
conn.configuration.set_force_single_threaded (True)
|
conn.configuration.set_force_single_threaded (True)
|
||||||
@@ -85,29 +84,30 @@ feature -- Execution
|
|||||||
launch
|
launch
|
||||||
-- <Precursor/>
|
-- <Precursor/>
|
||||||
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
||||||
|
local
|
||||||
|
conn: like connector
|
||||||
do
|
do
|
||||||
if attached connector as conn then
|
conn := connector
|
||||||
conn.set_base (base_url)
|
conn.set_base (base_url)
|
||||||
if single_threaded then
|
if single_threaded then
|
||||||
conn.configuration.set_force_single_threaded (True)
|
conn.configuration.set_force_single_threaded (True)
|
||||||
end
|
end
|
||||||
conn.configuration.set_is_verbose (verbose)
|
conn.configuration.set_is_verbose (verbose)
|
||||||
debug ("nino")
|
debug ("nino")
|
||||||
if verbose then
|
if verbose then
|
||||||
io.error.put_string ("Launching Nino web server on port " + port_number.out)
|
io.error.put_string ("Launching Nino web server on port " + port_number.out)
|
||||||
if attached server_name as l_name then
|
if attached server_name as l_name then
|
||||||
io.error.put_string ("%N http://" + l_name + ":" + port_number.out + "/" + base_url + "%N")
|
io.error.put_string ("%N http://" + l_name + ":" + port_number.out + "/" + base_url + "%N")
|
||||||
else
|
else
|
||||||
io.error.put_string ("%N http://localhost:" + port_number.out + "/" + base_url + "%N")
|
io.error.put_string ("%N http://localhost:" + port_number.out + "/" + base_url + "%N")
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if attached server_name as l_server_name then
|
|
||||||
conn.configuration.set_http_server_name (l_server_name)
|
|
||||||
end
|
|
||||||
conn.configuration.http_server_port := port_number
|
|
||||||
conn.launch
|
|
||||||
end
|
end
|
||||||
|
if attached server_name as l_server_name then
|
||||||
|
conn.configuration.set_http_server_name (l_server_name)
|
||||||
|
end
|
||||||
|
conn.configuration.http_server_port := port_number
|
||||||
|
conn.launch
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Callback
|
feature -- Callback
|
||||||
@@ -142,7 +142,7 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
connector: detachable WGI_NINO_CONNECTOR
|
connector: WGI_NINO_CONNECTOR [G]
|
||||||
-- Default connector
|
-- Default connector
|
||||||
|
|
||||||
launchable: BOOLEAN
|
launchable: BOOLEAN
|
||||||
@@ -151,7 +151,7 @@ feature -- Status report
|
|||||||
end
|
end
|
||||||
|
|
||||||
;note
|
;note
|
||||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -5,19 +5,17 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_CGI_SERVICE_LAUNCHER
|
WSF_CGI_SERVICE_LAUNCHER [G]
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_and_launch,
|
make_and_launch
|
||||||
make_callback,
|
|
||||||
make_callback_and_launch
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
17
library/server/wsf/default/httpd-safe.ecf
Normal file
17
library/server/wsf/default/httpd-safe.ecf
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-12-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-12-0 http://www.eiffel.com/developers/xml/configuration-1-12-0.xsd" name="default_httpd" uuid="5CBA8C5A-3191-434A-8DE1-C0C3CAC9C4F4" library_target="default_httpd">
|
||||||
|
<target name="default_httpd">
|
||||||
|
<root all_classes="true"/>
|
||||||
|
<file_rule>
|
||||||
|
<exclude>/EIFGENs$</exclude>
|
||||||
|
<exclude>/\.git$</exclude>
|
||||||
|
<exclude>/\.svn$</exclude>
|
||||||
|
</file_rule>
|
||||||
|
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional">
|
||||||
|
</option>
|
||||||
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
|
<library name="wsf" location="..\wsf-safe.ecf"/>
|
||||||
|
<library name="wsf_httpd" location="..\connector\httpd-safe.ecf"/>
|
||||||
|
<cluster name="default_httpd" location=".\httpd\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
</system>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_DEFAULT_RESPONSE_SERVICE}."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
WSF_DEFAULT_RESPONSE_SERVICE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_DEFAULT_SERVICE
|
||||||
|
|
||||||
|
WSF_RESPONSE_SERVICE
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
end
|
||||||
22
library/server/wsf/default/httpd/wsf_default_service.e
Normal file
22
library/server/wsf/default/httpd/wsf_default_service.e
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WSF_DEFAULT_SERVICE}."
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
WSF_DEFAULT_SERVICE [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER [G]]
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
source: "[
|
||||||
|
Eiffel Software
|
||||||
|
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||||
|
Telephone 805-685-1006, Fax 805-685-6869
|
||||||
|
Website http://www.eiffel.com
|
||||||
|
Customer support http://support.eiffel.com
|
||||||
|
]"
|
||||||
|
end
|
||||||
@@ -1,21 +1,19 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_HTTPD_REQUEST_HANDLER_FACTORY}."
|
description: "[
|
||||||
author: ""
|
Default launcher for WSF_SERVICE based on {WSF_HTTPD_SERVICE_LAUNCHER}
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_HTTPD_REQUEST_HANDLER_FACTORY [G -> WSF_EXECUTION create make end]
|
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
HTTPD_REQUEST_HANDLER_FACTORY
|
WSF_HTTPD_SERVICE_LAUNCHER [G]
|
||||||
|
|
||||||
feature -- Factory
|
create
|
||||||
|
make,
|
||||||
new_handler: separate WSF_HTTPD_REQUEST_HANDLER [G]
|
make_and_launch
|
||||||
do
|
|
||||||
create Result.make
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
@@ -27,4 +25,5 @@ note
|
|||||||
Website http://www.eiffel.com
|
Website http://www.eiffel.com
|
||||||
Customer support http://support.eiffel.com
|
Customer support http://support.eiffel.com
|
||||||
]"
|
]"
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -4,10 +4,10 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
WSF_DEFAULT_SERVICE
|
WSF_DEFAULT_SERVICE [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER [G]]
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
|||||||
@@ -6,16 +6,14 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_NINO_SERVICE_LAUNCHER
|
WSF_NINO_SERVICE_LAUNCHER [G]
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_and_launch,
|
make_and_launch
|
||||||
make_callback,
|
|
||||||
make_callback_and_launch
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
|||||||
@@ -67,7 +67,11 @@ feature -- Access
|
|||||||
|
|
||||||
|
|
||||||
create p.make_with_body (s)
|
create p.make_with_body (s)
|
||||||
if {PLATFORM}.is_windows and req.wgi_connector.name.is_case_insensitive_equal ("cgi") then
|
if
|
||||||
|
{PLATFORM}.is_windows and then
|
||||||
|
attached req.wgi_connector as conn and then
|
||||||
|
is_cgi_connector (conn)
|
||||||
|
then
|
||||||
--| FIXME: the CGI connector add %R for any single %N character, so update the Content-Length accordingly.
|
--| FIXME: the CGI connector add %R for any single %N character, so update the Content-Length accordingly.
|
||||||
-- Dirty hack to handle correctly CGI on Windows, since it seems "abc%N" will be sent as "abc%R%N"
|
-- Dirty hack to handle correctly CGI on Windows, since it seems "abc%N" will be sent as "abc%R%N"
|
||||||
l_len := 0
|
l_len := 0
|
||||||
@@ -96,9 +100,17 @@ feature -- Access
|
|||||||
res.send (p)
|
res.send (p)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_cgi_connector (conn: separate WGI_CONNECTOR): BOOLEAN
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
create s.make_from_separate (conn.name)
|
||||||
|
Result := s.is_case_insensitive_equal_general ("cgi")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -61,12 +61,32 @@ feature -- Execution
|
|||||||
a_output.append (" version=")
|
a_output.append (" version=")
|
||||||
a_output.append (req.wgi_version)
|
a_output.append (req.wgi_version)
|
||||||
a_output.append (" connector=%"")
|
a_output.append (" connector=%"")
|
||||||
a_output.append (req.wgi_connector.name)
|
if attached req.wgi_connector as conn then
|
||||||
a_output.append (" connector-version=")
|
append_connector_name_to (conn, a_output)
|
||||||
a_output.append (req.wgi_connector.version)
|
a_output.append ("%" connector-version=")
|
||||||
|
append_connector_version_to (conn, a_output)
|
||||||
|
else
|
||||||
|
a_output.append ("none")
|
||||||
|
end
|
||||||
a_output.append (eol)
|
a_output.append (eol)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
append_connector_name_to (conn: separate WGI_CONNECTOR; a_output: STRING)
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
create s.make_from_separate (conn.name)
|
||||||
|
a_output.append (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
append_connector_version_to (conn: separate WGI_CONNECTOR; a_output: STRING)
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
|
do
|
||||||
|
create s.make_from_separate (conn.version)
|
||||||
|
a_output.append (s)
|
||||||
|
end
|
||||||
|
|
||||||
append_cgi_variables_to (req: WSF_REQUEST; res: WSF_RESPONSE; a_output: STRING)
|
append_cgi_variables_to (req: WSF_REQUEST; res: WSF_RESPONSE; a_output: STRING)
|
||||||
do
|
do
|
||||||
a_output.append ("CGI variables:")
|
a_output.append ("CGI variables:")
|
||||||
@@ -385,7 +405,7 @@ feature -- Constants
|
|||||||
invariant
|
invariant
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
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
|
inherit
|
||||||
WSF_LAUNCHABLE_SERVICE
|
WSF_LAUNCHABLE_SERVICE
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||||
local
|
local
|
||||||
l_launcher: G
|
l_launcher: G
|
||||||
do
|
do
|
||||||
create l_launcher.make_and_launch (a_service, opts)
|
create l_launcher.make_and_launch (opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ feature {NONE} -- Initialization
|
|||||||
frozen make_and_launch
|
frozen make_and_launch
|
||||||
do
|
do
|
||||||
initialize
|
initialize
|
||||||
launch (Current, service_options)
|
launch (service_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
@@ -25,7 +25,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS
|
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
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ feature -- Default service options
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -10,26 +10,8 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WSF_SERVICE
|
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
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -32,45 +32,31 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
WSF_SERVICE_LAUNCHER
|
WSF_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
WSF_TO_WGI_SERVICE
|
WSF_TO_WGI_SERVICE
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
frozen make (a_service: like service; a_options: like options)
|
frozen make (a_options: like options)
|
||||||
do
|
do
|
||||||
make_from_service (a_service)
|
|
||||||
options := a_options
|
options := a_options
|
||||||
initialize
|
initialize
|
||||||
ensure
|
ensure
|
||||||
service_set: service = a_service
|
|
||||||
options_set: options = a_options
|
options_set: options = a_options
|
||||||
launchable: launchable
|
launchable: launchable
|
||||||
end
|
end
|
||||||
|
|
||||||
frozen make_and_launch (a_service: like service; a_options: like options)
|
frozen make_and_launch (a_options: like options)
|
||||||
do
|
do
|
||||||
make (a_service, a_options)
|
make (a_options)
|
||||||
launch
|
launch
|
||||||
end
|
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
|
||||||
-- Initialize Current using `options' if attached
|
-- Initialize Current using `options' if attached
|
||||||
-- and build the connector
|
-- and build the connector
|
||||||
require
|
|
||||||
service_set: service /= Void
|
|
||||||
deferred
|
deferred
|
||||||
ensure
|
ensure
|
||||||
connector_attached: connector /= Void
|
connector_attached: connector /= Void
|
||||||
@@ -120,7 +106,7 @@ invariant
|
|||||||
connector_attached: connector /= Void
|
connector_attached: connector /= Void
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -13,47 +13,8 @@ class
|
|||||||
inherit
|
inherit
|
||||||
WGI_SERVICE
|
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
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
WSF_EXECUTION
|
WSF_EXECUTION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
WGI_EXECUTION
|
||||||
|
rename
|
||||||
|
request as wgi_request,
|
||||||
|
response as wgi_response
|
||||||
|
redefine
|
||||||
|
make,
|
||||||
|
execute,
|
||||||
|
clean
|
||||||
|
end
|
||||||
|
|
||||||
--create
|
--create
|
||||||
-- make
|
-- make
|
||||||
|
|
||||||
@@ -14,24 +25,72 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
make (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||||
do
|
do
|
||||||
create request.make_from_wgi (req)
|
Precursor (req, res)
|
||||||
create response.make_from_wgi (res)
|
create request.make_from_wgi (wgi_request)
|
||||||
|
create response.make_from_wgi (wgi_response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Access
|
||||||
|
|
||||||
request: WSF_REQUEST
|
request: WSF_REQUEST
|
||||||
|
-- Access to request data.
|
||||||
|
-- Header, Query, Post, Input data..
|
||||||
|
|
||||||
response: WSF_RESPONSE
|
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
|
feature -- Execution
|
||||||
|
|
||||||
execute
|
execute
|
||||||
|
-- Execute Current `request',
|
||||||
|
-- getting data from `request'
|
||||||
|
-- and response to client via `response'.
|
||||||
deferred
|
deferred
|
||||||
ensure
|
ensure then
|
||||||
response.status_is_set
|
status_is_set: response.status_is_set
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Cleaning
|
||||||
|
|
||||||
|
clean
|
||||||
|
-- Precursor
|
||||||
|
do
|
||||||
|
Precursor
|
||||||
|
request.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ inherit
|
|||||||
{NONE} all
|
{NONE} all
|
||||||
end
|
end
|
||||||
|
|
||||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION}
|
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION, WGI_EXPORTER}
|
||||||
make_from_wgi
|
make_from_wgi
|
||||||
|
|
||||||
convert
|
convert
|
||||||
@@ -426,7 +426,7 @@ feature -- Eiffel WGI access
|
|||||||
Result := wgi_request.wgi_implementation
|
Result := wgi_request.wgi_implementation
|
||||||
end
|
end
|
||||||
|
|
||||||
wgi_connector: detachable WGI_CONNECTOR
|
wgi_connector: detachable separate WGI_CONNECTOR
|
||||||
-- Associated Eiffel WGI connector
|
-- Associated Eiffel WGI connector
|
||||||
do
|
do
|
||||||
Result := wgi_request.wgi_connector
|
Result := wgi_request.wgi_connector
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ note
|
|||||||
class
|
class
|
||||||
WSF_RESPONSE
|
WSF_RESPONSE
|
||||||
|
|
||||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION}
|
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION, WGI_EXPORTER}
|
||||||
make_from_wgi
|
make_from_wgi
|
||||||
|
|
||||||
create {WSF_RESPONSE}
|
create {WSF_RESPONSE}
|
||||||
|
|||||||
Reference in New Issue
Block a user