Implemented WSF_RESPONSE.put_error (...) and related
Added WSF_RESPONSE.put_character Renamed WGI_OUTPUT_STREAM.put_character_8 as put_character to follow style of put_string (and not put_string_8) Refactored the WSF_DEFAULT_SERVICE_LAUNCHER Added WSF_DEFAULT_SERVICE to be more user friendly Splitted the wsf/default/ libraries to have wsf/connector/... and being able to handle more than one connector in the same application
This commit is contained in:
30
library/server/wsf/connector/all-safe.ecf
Normal file
30
library/server/wsf/connector/all-safe.ecf
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_all" uuid="223E2E7D-AA90-4ADC-93CB-D304E794E3E6" library_target="wsf_all">
|
||||
<target name="wsf_all">
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_cgi" location="../../ewsgi/connectors/cgi/cgi-safe.ecf"/>
|
||||
<library name="connector_libfcgi" location="../../ewsgi/connectors/libfcgi/libfcgi-safe.ecf"/>
|
||||
<library name="connector_nino" location="../../ewsgi/connectors/nino/nino-safe.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\contrib\library\server\nino\nino-safe.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<cluster name="wsf_nino" location="./nino" recursive="true"/>
|
||||
<cluster name="wsf_cgi" location="./cgi" recursive="true"/>
|
||||
<cluster name="wsf_libfcgi" location="./libfcgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
22
library/server/wsf/connector/cgi-safe.ecf
Normal file
22
library/server/wsf/connector/cgi-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-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_cgi" uuid="1B416A7F-D49B-43FC-8308-F14AA9531AF8" library_target="wsf_cgi">
|
||||
<target name="wsf_cgi">
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_cgi" location="../../ewsgi/connectors/cgi/cgi-safe.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<cluster name="wsf_cgi" location="./cgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
22
library/server/wsf/connector/cgi.ecf
Normal file
22
library/server/wsf/connector/cgi.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-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_cgi" uuid="1B416A7F-D49B-43FC-8308-F14AA9531AF8" library_target="wsf_cgi">
|
||||
<target name="wsf_cgi">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_cgi" location="../../ewsgi/connectors/cgi/cgi.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<cluster name="wsf_cgi" location="./cgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
64
library/server/wsf/connector/cgi/wsf_cgi_service_launcher.e
Normal file
64
library/server/wsf/connector/cgi/wsf_cgi_service_launcher.e
Normal file
@@ -0,0 +1,64 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
CGI for this class
|
||||
|
||||
How-to:
|
||||
|
||||
s: WSF_SERVICE_CGI_LAUNCHER
|
||||
create s.make_and_launch (agent execute)
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
-- ...
|
||||
end
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_CGI_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
create connector.make (Current)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_CGI_CONNECTOR
|
||||
-- Default service name
|
||||
|
||||
;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/connector/libfcgi-safe.ecf
Normal file
22
library/server/wsf/connector/libfcgi-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-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_libfcgi" uuid="00B169F1-2BE2-4986-8B93-825FEB944FFD" library_target="wsf_libfcgi">
|
||||
<target name="wsf_libfcgi">
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_libfcgi" location="../../ewsgi/connectors/libfcgi/libfcgi-safe.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<cluster name="wsf_libfcgi" location="./libfcgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
22
library/server/wsf/connector/libfcgi.ecf
Normal file
22
library/server/wsf/connector/libfcgi.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-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_libfcgi" uuid="00B169F1-2BE2-4986-8B93-825FEB944FFD" library_target="wsf_libfcgi">
|
||||
<target name="wsf_libfcgi">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_libfcgi" location="../../ewsgi/connectors/libfcgi/libfcgi.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<cluster name="wsf_libfcgi" location="./libfcgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -0,0 +1,64 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
libFCGI for this class
|
||||
|
||||
How-to:
|
||||
|
||||
s: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
create s.make_and_launch (agent execute)
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
-- ...
|
||||
end
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_LIBFCGI_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
create connector.make (Current)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_LIBFCGI_CONNECTOR
|
||||
-- Default service name
|
||||
|
||||
;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
|
||||
10
library/server/wsf/connector/license.lic
Normal file
10
library/server/wsf/connector/license.lic
Normal file
@@ -0,0 +1,10 @@
|
||||
${NOTE_KEYWORD}
|
||||
copyright: "2011-${YEAR}, 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
|
||||
]"
|
||||
26
library/server/wsf/connector/nino-safe.ecf
Normal file
26
library/server/wsf/connector/nino-safe.ecf
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_nino" uuid="BACF0220-900B-4409-8CB2-30A09836A650" library_target="wsf_nino">
|
||||
<target name="wsf_nino">
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_nino" location="../../ewsgi/connectors/nino/nino-safe.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\contrib\library\server\nino\nino-safe.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<cluster name="wsf_nino" location="./nino" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
26
library/server/wsf/connector/nino.ecf
Normal file
26
library/server/wsf/connector/nino.ecf
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-8-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-8-0 http://www.eiffel.com/developers/xml/configuration-1-8-0.xsd" name="wsf_nino" uuid="BACF0220-900B-4409-8CB2-30A09836A650" library_target="wsf_nino">
|
||||
<target name="wsf_nino">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_nino" location="../../ewsgi/connectors/nino/nino.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\contrib\library\server\nino\nino.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<cluster name="wsf_nino" location="./nino" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
128
library/server/wsf/connector/nino/wsf_nino_service_launcher.e
Normal file
128
library/server/wsf/connector/nino/wsf_nino_service_launcher.e
Normal file
@@ -0,0 +1,128 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
Eiffel Web Nino for this class
|
||||
|
||||
|
||||
The Nino 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_NINO_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_SERVICE_LAUNCHER
|
||||
redefine
|
||||
launchable
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
port_number := 80 --| Default, but quite often, this port is already used ...
|
||||
base_url := ""
|
||||
|
||||
if attached options as opts then
|
||||
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 connector.make (Current)
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
-- <Precursor/>
|
||||
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
debug ("nino")
|
||||
if verbose then
|
||||
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
|
||||
end
|
||||
conn.configuration.http_server_port := port_number
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
port_number: INTEGER
|
||||
|
||||
base_url: READABLE_STRING_8
|
||||
|
||||
verbose: BOOLEAN
|
||||
|
||||
single_threaded: BOOLEAN
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_NINO_CONNECTOR
|
||||
-- Default connector
|
||||
|
||||
launchable: BOOLEAN
|
||||
do
|
||||
Result := Precursor and port_number > 0
|
||||
end
|
||||
|
||||
;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
|
||||
@@ -7,16 +7,9 @@
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_cgi" location="../../ewsgi/connectors/cgi/cgi-safe.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_cgi" location="../connector/cgi-safe.ecf"/>
|
||||
<cluster name="default_cgi" location="./cgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -9,14 +9,8 @@
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_cgi" location="../../ewsgi/connectors/cgi/cgi.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="wsf_cgi" location="../connector/cgi.ecf"/>
|
||||
<cluster name="default_cgi" location="./cgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
22
library/server/wsf/default/cgi/wsf_default_service.e
Normal file
22
library/server/wsf/default/cgi/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
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
|
||||
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
|
||||
@@ -1,19 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
CGI for this class
|
||||
|
||||
How-to:
|
||||
|
||||
s: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
create s.make_and_launch (agent execute)
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
-- ...
|
||||
end
|
||||
]"
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -21,36 +8,17 @@ class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER_I
|
||||
WSF_CGI_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_and_launch_with_options
|
||||
make_callback,
|
||||
make_callback_and_launch,
|
||||
make_and_launch_with_options -- obsolete
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
create connector.make (Current)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_CGI_CONNECTOR
|
||||
-- Default service name
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
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
|
||||
@@ -59,4 +27,5 @@ feature -- Status report
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -7,16 +7,9 @@
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_libfcgi" location="../../ewsgi/connectors/libfcgi/libfcgi-safe.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_libfcgi" location="../connector/libfcgi-safe.ecf"/>
|
||||
<cluster name="default_libfcgi" location="./libfcgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -7,16 +7,9 @@
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_libfcgi" location="../../ewsgi/connectors/libfcgi/libfcgi.ecf"/>
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="wsf_libfcgi" location="../connector/libfcgi.ecf"/>
|
||||
<cluster name="default_libfcgi" location="./libfcgi" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
22
library/server/wsf/default/libfcgi/wsf_default_service.e
Normal file
22
library/server/wsf/default/libfcgi/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
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
|
||||
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
|
||||
@@ -1,19 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
libFCGI for this class
|
||||
|
||||
How-to:
|
||||
|
||||
s: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
create s.make_and_launch (agent execute)
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
-- ...
|
||||
end
|
||||
]"
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE_LAUNCHER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -21,36 +8,17 @@ class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER_I
|
||||
WSF_LIBFCGI_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_and_launch_with_options
|
||||
make_callback,
|
||||
make_callback_and_launch,
|
||||
make_and_launch_with_options -- obsolete
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
create connector.make (Current)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_LIBFCGI_CONNECTOR
|
||||
-- Default service name
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
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
|
||||
@@ -59,4 +27,5 @@ feature -- Status report
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
10
library/server/wsf/default/license.lic
Normal file
10
library/server/wsf/default/license.lic
Normal file
@@ -0,0 +1,10 @@
|
||||
${NOTE_KEYWORD}
|
||||
copyright: "2011-${YEAR}, 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
|
||||
]"
|
||||
@@ -7,20 +7,9 @@
|
||||
<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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi-safe.ecf"/>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="provisional"/>
|
||||
<library name="wsf" location="../wsf-safe.ecf"/>
|
||||
<library name="connector_nino" location="../../ewsgi/connectors/nino/nino-safe.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\contrib\library\server\nino\nino-safe.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
|
||||
<library name="error" location="..\..\..\error\error-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_nino" location="../connector/nino-safe.ecf"/>
|
||||
<cluster name="default_nino" location="./nino" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -7,20 +7,9 @@
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="ewsgi" location="../../ewsgi/ewsgi.ecf"/>
|
||||
<option warning="true" full_class_checking="true" syntax="provisional"/>
|
||||
<library name="wsf" location="../wsf.ecf"/>
|
||||
<library name="connector_nino" location="../../ewsgi/connectors/nino/nino.ecf"/>
|
||||
<library name="nino" location="..\..\..\..\contrib\library\server\nino\nino.ecf" readonly="false">
|
||||
<renaming old_name="HTTP_CONSTANTS" new_name="NINO_HTTP_CONSTANTS"/>
|
||||
</library>
|
||||
|
||||
<library name="error" location="..\..\..\error\error.ecf"/>
|
||||
<library name="http" location="..\..\..\protocol\http\http.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="wsf_nino" location="../connector/nino.ecf"/>
|
||||
<cluster name="default_nino" location="./nino" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
22
library/server/wsf/default/nino/wsf_default_service.e
Normal file
22
library/server/wsf/default/nino/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
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
|
||||
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
|
||||
@@ -1,17 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Component to launch the service using the default connector
|
||||
|
||||
Eiffel Web Nino for this class
|
||||
|
||||
|
||||
The Nino 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_DEFAULT_SERVICE_LAUNCHER_I for more documentation
|
||||
Default launcher for WSF_SERVICE based on {WSF_NINO_SERVICE_LAUNCHER}
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -20,114 +9,17 @@ class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER_I
|
||||
redefine
|
||||
launchable
|
||||
end
|
||||
WSF_NINO_SERVICE_LAUNCHER
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_and_launch_with_options
|
||||
make_callback,
|
||||
make_callback_and_launch,
|
||||
make_and_launch_with_options -- obsolete
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
l_name: detachable READABLE_STRING_GENERAL
|
||||
do
|
||||
port_number := 80 --| Default, but quite often, this port is already used ...
|
||||
base_url := ""
|
||||
if attached options as opts then
|
||||
across
|
||||
opts as opt
|
||||
loop
|
||||
if attached opt.item as l_opt_item then
|
||||
l_name := l_opt_item.name
|
||||
if l_name.same_string ("port") then
|
||||
if attached {INTEGER} l_opt_item.value as l_port then
|
||||
port_number := l_port
|
||||
elseif
|
||||
attached {READABLE_STRING_GENERAL} l_opt_item.value as l_port_str and then
|
||||
l_port_str.is_integer
|
||||
then
|
||||
port_number := l_port_str.as_string_8.to_integer
|
||||
end
|
||||
elseif l_name.same_string ("base") then
|
||||
if attached {READABLE_STRING_GENERAL} l_opt_item.value as l_base_str then
|
||||
base_url := l_base_str.as_string_8
|
||||
end
|
||||
elseif l_name.same_string ("force_single_threaded") then
|
||||
if attached {BOOLEAN} l_opt_item.value as l_single_threaded then
|
||||
single_threaded := l_single_threaded
|
||||
elseif attached {READABLE_STRING_GENERAL} l_opt_item.value as l_single_threaded_str then
|
||||
single_threaded := l_single_threaded_str.as_lower.same_string ("true")
|
||||
end
|
||||
elseif l_name.same_string ("verbose") then
|
||||
if attached {BOOLEAN} l_opt_item.value as l_verbose then
|
||||
verbose := l_verbose
|
||||
elseif attached {READABLE_STRING_GENERAL} l_opt_item.value as l_verbose_str then
|
||||
verbose := l_verbose_str.as_lower.same_string ("true")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
create connector.make (Current)
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch
|
||||
-- <Precursor/>
|
||||
-- using `port_number', `base_url', `verbose' and `single_threaded'
|
||||
do
|
||||
if attached connector as conn then
|
||||
conn.set_base (base_url)
|
||||
if single_threaded then
|
||||
conn.configuration.set_force_single_threaded (True)
|
||||
end
|
||||
conn.configuration.set_is_verbose (verbose)
|
||||
debug ("nino")
|
||||
if verbose then
|
||||
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
|
||||
end
|
||||
conn.configuration.http_server_port := port_number
|
||||
conn.launch
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
port_number: INTEGER
|
||||
|
||||
base_url: READABLE_STRING_8
|
||||
|
||||
verbose: BOOLEAN
|
||||
|
||||
single_threaded: BOOLEAN
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: detachable WGI_NINO_CONNECTOR
|
||||
-- Default connector
|
||||
|
||||
launchable: BOOLEAN
|
||||
do
|
||||
Result := Precursor and port_number > 0
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2011, Eiffel Software and others"
|
||||
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
|
||||
@@ -136,4 +28,5 @@ feature -- Status report
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for WSF_AGENT_HANDLER."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ deferred class
|
||||
inherit
|
||||
WSF_HANDLER [C]
|
||||
|
||||
feature -- Execution
|
||||
feature -- Response
|
||||
|
||||
response (ctx: C; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
require
|
||||
@@ -27,7 +27,7 @@ feature -- Execution
|
||||
Result_attached: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Implementation
|
||||
feature -- Execution
|
||||
|
||||
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
|
||||
52
library/server/wsf/src/service/wsf_callback_service.e
Normal file
52
library/server/wsf/src/service/wsf_callback_service.e
Normal file
@@ -0,0 +1,52 @@
|
||||
note
|
||||
description: "[
|
||||
Create this service with a callback to implement {WSF_SERVICE}.execute (req, res)
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_CALLBACK_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
make ({PROCEDURE [ANY, TUPLE [WSF_REQUEST, WSF_RESPONSE]]})
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
make (a_callback: like callback)
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
callback := a_callback
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
callback: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]
|
||||
-- Procedure called on `execute'
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the request
|
||||
do
|
||||
callback.call ([req, res])
|
||||
end
|
||||
|
||||
invariant
|
||||
callback_attached: callback /= Void
|
||||
|
||||
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
|
||||
50
library/server/wsf/src/service/wsf_default_service_i.e
Normal file
50
library/server/wsf/src/service/wsf_default_service_i.e
Normal file
@@ -0,0 +1,50 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_SERVICE_I}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE_I [G -> WSF_SERVICE_LAUNCHER create make_and_launch end]
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_and_launch
|
||||
local
|
||||
l_launcher: G
|
||||
do
|
||||
create l_launcher.make_and_launch (Current, service_options)
|
||||
end
|
||||
|
||||
service_options: detachable WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
|
||||
feature -- Default service options
|
||||
|
||||
set_service_option (a_name: READABLE_STRING_GENERAL; a_value: detachable ANY)
|
||||
-- Set options related to WSF_DEFAULT_SERVICE
|
||||
local
|
||||
opts: like service_options
|
||||
do
|
||||
opts := service_options
|
||||
if opts = Void then
|
||||
create opts.make
|
||||
service_options := opts
|
||||
end
|
||||
opts.set_option (a_name, a_value)
|
||||
ensure
|
||||
attached service_options as l_options and then l_options.option (a_name) = a_value
|
||||
end
|
||||
|
||||
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
|
||||
41
library/server/wsf/src/service/wsf_response_service.e
Normal file
41
library/server/wsf/src/service/wsf_response_service.e
Normal file
@@ -0,0 +1,41 @@
|
||||
note
|
||||
description: "[
|
||||
Inherit from this class to implement the main entry of your web service
|
||||
You just need to implement `execute', get data from the request `req'
|
||||
and return a response message
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_RESPONSE_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
deferred
|
||||
ensure
|
||||
Result_attached: Result /= Void
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
res.send (response (req))
|
||||
end
|
||||
|
||||
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
|
||||
@@ -10,11 +10,11 @@ note
|
||||
deferred class
|
||||
WSF_SERVICE
|
||||
|
||||
inherit
|
||||
WGI_SERVICE
|
||||
rename
|
||||
execute as wgi_execute
|
||||
end
|
||||
--inherit
|
||||
-- WGI_SERVICE
|
||||
-- rename
|
||||
-- execute as wgi_execute
|
||||
-- end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
@@ -26,25 +26,25 @@ feature -- Execution
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {WGI_CONNECTOR} -- WGI Execution
|
||||
--feature {WGI_CONNECTOR} -- WGI Execution
|
||||
|
||||
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
|
||||
-- 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
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
@@ -4,8 +4,11 @@ note
|
||||
|
||||
How-to:
|
||||
|
||||
s: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
create s.make_and_launch (agent execute)
|
||||
s: WSF_SERVICE_LAUNCHER
|
||||
create s.make_and_launch (service)
|
||||
|
||||
`service' can be Current if inherit from WSF_SERVICE
|
||||
or also `create {WSF_CALLBACK_SERVICE}.make (agent execute)'
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
@@ -29,43 +32,54 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER_I
|
||||
WSF_SERVICE_LAUNCHER
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
WSF_TO_WGI_SERVICE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
frozen make (a_action: like action; a_options: like options)
|
||||
frozen make (a_service: like service; a_options: like options)
|
||||
do
|
||||
action := a_action
|
||||
make_from_service (a_service)
|
||||
options := a_options
|
||||
initialize
|
||||
ensure
|
||||
action_set: action = a_action
|
||||
service_set: service = a_service
|
||||
options_set: options = a_options
|
||||
launchable: launchable
|
||||
end
|
||||
|
||||
frozen make_and_launch (a_action: like action)
|
||||
do
|
||||
make (a_action, Void)
|
||||
launch
|
||||
end
|
||||
|
||||
frozen make_and_launch_with_options (a_action: like action; a_options: attached like options)
|
||||
frozen make_and_launch (a_service: like service; a_options: like options)
|
||||
require
|
||||
a_options_attached: a_options /= Void
|
||||
do
|
||||
make (a_action, a_options)
|
||||
make (a_service, a_options)
|
||||
launch
|
||||
end
|
||||
|
||||
frozen make_callback (a_callback: like {WSF_CALLBACK_SERVICE}.callback; a_options: like options)
|
||||
do
|
||||
make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options)
|
||||
end
|
||||
|
||||
frozen make_callback_and_launch (a_callback: like {WSF_CALLBACK_SERVICE}.callback; a_options: like options)
|
||||
do
|
||||
make (create {WSF_CALLBACK_SERVICE}.make (a_callback), a_options)
|
||||
end
|
||||
|
||||
frozen make_and_launch_with_options (a_callback: like {WSF_CALLBACK_SERVICE}.callback; a_options: like options)
|
||||
obsolete
|
||||
"[2012-Mars-20] Use make_callback_and_launch (a_callback, a_options)"
|
||||
do
|
||||
make_callback_and_launch (a_callback, a_options)
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize Current using `options' if attached
|
||||
-- and build the connector
|
||||
require
|
||||
action_set: action /= Void
|
||||
service_set: service /= Void
|
||||
deferred
|
||||
ensure
|
||||
connector_attached: connector /= Void
|
||||
@@ -108,20 +122,9 @@ feature -- Execution
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
options: detachable ARRAY [detachable TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]
|
||||
options: detachable WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
-- Custom options which might be support (or not) by the default service
|
||||
|
||||
action: PROCEDURE [ANY, TUPLE [WSF_REQUEST, WSF_RESPONSE]]
|
||||
-- Action to be executed on request incoming
|
||||
|
||||
feature {NONE} -- Implementation: Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
action.call ([req, res])
|
||||
end
|
||||
|
||||
invariant
|
||||
connector_attached: connector /= Void
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
note
|
||||
description: "[
|
||||
Options used by WSF_SERVICE_LAUNCHER
|
||||
|
||||
For instance options supported by Nino as default connector::
|
||||
port: numeric such as 8099 (or equivalent string as "8099")
|
||||
base: base_url (very specific to standalone server)
|
||||
force_single_threaded: use only one thread, useful for Nino
|
||||
verbose: to display verbose output, useful for Nino
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_SERVICE_LAUNCHER_OPTIONS
|
||||
|
||||
create
|
||||
make,
|
||||
make_from_array
|
||||
|
||||
convert
|
||||
make_from_array ({ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create options.make (0)
|
||||
end
|
||||
|
||||
make_from_array (a_options: ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]])
|
||||
do
|
||||
make
|
||||
across
|
||||
a_options as opt
|
||||
loop
|
||||
if attached opt.item as o then
|
||||
set_option (o.name, o.value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
option (a_name: READABLE_STRING_GENERAL): detachable ANY
|
||||
do
|
||||
Result := options.item (a_name)
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_option (a_name: READABLE_STRING_GENERAL; a_value: detachable ANY)
|
||||
do
|
||||
options.force (a_value, a_name)
|
||||
end
|
||||
|
||||
set_verbose (b: BOOLEAN)
|
||||
-- Set option "verbose" to `b'
|
||||
do
|
||||
set_option ("verbose", b)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
options: HASH_TABLE [detachable ANY, READABLE_STRING_GENERAL]
|
||||
-- Custom options which might be support (or not) by the default service
|
||||
|
||||
invariant
|
||||
options_attached: options /= Void
|
||||
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
|
||||
62
library/server/wsf/src/service/wsf_to_wgi_service.e
Normal file
62
library/server/wsf/src/service/wsf_to_wgi_service.e
Normal file
@@ -0,0 +1,62 @@
|
||||
note
|
||||
description: "[
|
||||
This class is the link between WGI_SERVICE and WSF_SERVICE
|
||||
It makes a WSF_SERVICE callable from the WGI_ world.
|
||||
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_TO_WGI_SERVICE
|
||||
|
||||
inherit
|
||||
WGI_SERVICE
|
||||
|
||||
create
|
||||
make_from_service
|
||||
|
||||
feature {NONE} -- Make
|
||||
|
||||
make_from_service (a_service: like service)
|
||||
-- Make from WSF_SERVICE `a_service'
|
||||
do
|
||||
service := a_service
|
||||
end
|
||||
|
||||
service: WSF_SERVICE
|
||||
-- Associated WSF_SERVICE
|
||||
|
||||
feature {WGI_CONNECTOR} -- Implementation: Execution
|
||||
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
-- Delegate the WGI processing to the WSF_SERVICE object
|
||||
-- <Precursor>
|
||||
local
|
||||
w_res: detachable WSF_RESPONSE
|
||||
w_req: detachable WSF_REQUEST
|
||||
do
|
||||
create w_res.make_from_wgi (res)
|
||||
create w_req.make_from_wgi (req)
|
||||
service.execute (w_req, w_res)
|
||||
w_req.destroy
|
||||
rescue
|
||||
if w_res /= Void then
|
||||
w_res.flush
|
||||
end
|
||||
if w_req /= Void then
|
||||
w_req.destroy
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
@@ -26,7 +26,7 @@ class
|
||||
inherit
|
||||
DEBUG_OUTPUT
|
||||
|
||||
create {WSF_SERVICE}
|
||||
create {WSF_TO_WGI_SERVICE}
|
||||
make_from_wgi
|
||||
|
||||
convert
|
||||
|
||||
@@ -8,7 +8,7 @@ note
|
||||
class
|
||||
WSF_RESPONSE
|
||||
|
||||
create {WSF_SERVICE}
|
||||
create {WSF_TO_WGI_SERVICE}
|
||||
make_from_wgi
|
||||
|
||||
convert
|
||||
@@ -117,6 +117,14 @@ feature -- Header output operation
|
||||
|
||||
feature -- Output operation
|
||||
|
||||
put_character (c: CHARACTER_8)
|
||||
-- Send the character `c'
|
||||
require
|
||||
message_writable: message_writable
|
||||
do
|
||||
wgi_response.put_character (c)
|
||||
end
|
||||
|
||||
put_string (s: READABLE_STRING_8)
|
||||
-- Send the string `s'
|
||||
require
|
||||
@@ -269,6 +277,15 @@ feature -- Redirect
|
||||
redirect_now_custom (a_url, {HTTP_STATUS_CODE}.temp_redirect, Void, [a_content, a_content_type])
|
||||
end
|
||||
|
||||
feature -- Error reporting
|
||||
|
||||
put_error (a_message: READABLE_STRING_8)
|
||||
-- Report error described by `a_message'
|
||||
-- This might be used by the underlying connector
|
||||
do
|
||||
wgi_response.put_error (a_message)
|
||||
end
|
||||
|
||||
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)"
|
||||
|
||||
@@ -35,10 +35,12 @@ 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 app.make_custom (agent wgi_execute, base_url)
|
||||
create w2w.make_from_service (Current)
|
||||
create app.make_custom (w2w, base_url)
|
||||
web_app := app
|
||||
|
||||
create wt.make (agent app.listen (port_number))
|
||||
@@ -116,7 +118,7 @@ feature {NONE} -- Events
|
||||
page.put_string ("Bye")
|
||||
end
|
||||
|
||||
page.send_to (res)
|
||||
res.send (page)
|
||||
end
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
|
||||
@@ -77,11 +77,11 @@ feature -- Tests
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_request (a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]): WSF_REQUEST
|
||||
new_request (a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]): WSF_REQUEST_NULL
|
||||
local
|
||||
wgi_req: WGI_REQUEST
|
||||
do
|
||||
create {WGI_REQUEST_NULL} wgi_req.make (Current, a_meta)
|
||||
create {WGI_REQUEST_NULL} wgi_req.make (a_meta)
|
||||
create Result.make_from_wgi (wgi_req)
|
||||
end
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (s: WSF_SERVICE; a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||
make (a_meta: ARRAY [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]])
|
||||
local
|
||||
ht: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
|
||||
i: WGI_NULL_INPUT_STREAM
|
||||
c: WGI_NULL_CONNECTOR
|
||||
do
|
||||
create c.make (s)
|
||||
create c.make
|
||||
create i.make
|
||||
create ht.make (a_meta.count)
|
||||
across
|
||||
|
||||
16
library/server/wsf/tests/src/wsf_request_null.e
Normal file
16
library/server/wsf/tests/src/wsf_request_null.e
Normal file
@@ -0,0 +1,16 @@
|
||||
note
|
||||
description: "Summary description for {WSF_REQUEST_NULL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_REQUEST_NULL
|
||||
|
||||
inherit
|
||||
WSF_REQUEST
|
||||
|
||||
create {WSF_TO_WGI_SERVICE, WSF_SERVICE}
|
||||
make_from_wgi
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user