Migrated most of the example and library to new design.
This commit is contained in:
@@ -16,10 +16,10 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_OPENSHIFT_SERVICE_LAUNCHER
|
||||
WSF_OPENSHIFT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_NINO_SERVICE_LAUNCHER
|
||||
WSF_NINO_SERVICE_LAUNCHER [G]
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
@@ -31,9 +31,7 @@ inherit
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -86,7 +84,7 @@ feature {NONE} -- Implementation
|
||||
|
||||
|
||||
;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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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">
|
||||
<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_standalone" uuid="9BF2D71A-0986-4025-9C97-15B65F07C568" library_target="wsf_standalone">
|
||||
<target name="wsf_standalone">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
@@ -10,13 +10,13 @@
|
||||
<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="connector_standalone" location="..\..\ewsgi\connectors\standalone\standalone-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"/>
|
||||
<cluster name="wsf_standalone" location=".\standalone\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
22
library/server/wsf/connector/standalone.ecf
Normal file
22
library/server/wsf/connector/standalone.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_standalone" uuid="9BF2D71A-0986-4025-9C97-15B65F07C568" library_target="wsf_standalone">
|
||||
<target name="wsf_standalone">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="connector_standalone" location="..\..\ewsgi\connectors\standalone\standalone.ecf"/>
|
||||
<library name="encoder" location="..\..\..\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="error" location="..\..\..\utility\general\error\error.ecf"/>
|
||||
<library name="ewsgi" location="..\..\ewsgi\ewsgi.ecf"/>
|
||||
<library name="http" location="..\..\..\network\protocol\http\http.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="wsf" location="..\wsf.ecf"/>
|
||||
<cluster name="wsf_standalone" location=".\standalone\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -8,8 +8,8 @@ note
|
||||
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
|
||||
verbose: to display verbose output, useful for standalone connector
|
||||
force_single_threaded: use only one thread, useful for standalone connector
|
||||
|
||||
check WSF_SERVICE_LAUNCHER for more documentation
|
||||
]"
|
||||
@@ -17,7 +17,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_HTTPD_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
WSF_STANDALONE_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_SERVICE_LAUNCHER [G]
|
||||
@@ -71,7 +71,6 @@ feature {NONE} -- Initialization
|
||||
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)
|
||||
@@ -88,7 +87,6 @@ feature -- Execution
|
||||
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
|
||||
|
||||
@@ -102,7 +100,7 @@ feature -- Execution
|
||||
conn.set_base (base_url)
|
||||
debug ("nino")
|
||||
if verbose then
|
||||
io.error.put_string ("Launching Nino web server on port " + port_number.out)
|
||||
io.error.put_string ("Launching standalone 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
|
||||
@@ -116,24 +114,19 @@ feature -- Execution
|
||||
|
||||
feature -- Callback
|
||||
|
||||
on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||
on_launched_actions: ACTION_SEQUENCE [TUPLE [WGI_STANDALONE_CONNECTOR [G]]]
|
||||
-- Actions triggered when launched
|
||||
|
||||
on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_CONNECTOR]]
|
||||
on_stopped_actions: ACTION_SEQUENCE [TUPLE [WGI_STANDALONE_CONNECTOR [G]]]
|
||||
-- Actions triggered when stopped
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
on_launched (conn: WGI_CONNECTOR)
|
||||
on_launched (conn: WGI_STANDALONE_CONNECTOR [G])
|
||||
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
|
||||
@@ -146,7 +139,7 @@ feature {NONE} -- Implementation
|
||||
|
||||
feature -- Status report
|
||||
|
||||
connector: WGI_HTTPD_CONNECTOR [G]
|
||||
connector: WGI_STANDALONE_CONNECTOR [G]
|
||||
-- Default connector
|
||||
|
||||
launchable: BOOLEAN
|
||||
@@ -1,24 +0,0 @@
|
||||
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
|
||||
@@ -4,13 +4,13 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE
|
||||
WSF_DEFAULT_SERVICE [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER [G]]
|
||||
|
||||
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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
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
|
||||
@@ -1,24 +0,0 @@
|
||||
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
|
||||
@@ -4,13 +4,13 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE
|
||||
WSF_DEFAULT_SERVICE [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER [G]]
|
||||
|
||||
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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -5,19 +5,17 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_LIBFCGI_SERVICE_LAUNCHER
|
||||
WSF_LIBFCGI_SERVICE_LAUNCHER [G]
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
make_and_launch
|
||||
|
||||
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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_DEFAULT_RESPONSE_SERVICE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_RESPONSE_SERVICE [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE [G]
|
||||
|
||||
WSF_RESPONSE_SERVICE [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,24 +0,0 @@
|
||||
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
|
||||
@@ -4,13 +4,13 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_DEFAULT_SERVICE
|
||||
WSF_DEFAULT_SERVICE [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER]
|
||||
WSF_DEFAULT_SERVICE_I [WSF_DEFAULT_SERVICE_LAUNCHER [G]]
|
||||
|
||||
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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -6,19 +6,17 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_OPENSHIFT_SERVICE_LAUNCHER
|
||||
WSF_OPENSHIFT_SERVICE_LAUNCHER [G]
|
||||
|
||||
create
|
||||
make,
|
||||
make_and_launch,
|
||||
make_callback,
|
||||
make_callback_and_launch
|
||||
make_and_launch
|
||||
|
||||
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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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">
|
||||
<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_standalone" uuid="5CBA8C5A-3191-434A-8DE1-C0C3CAC9C4F4" library_target="default_standalone">
|
||||
<target name="default_standalone">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
@@ -11,7 +11,7 @@
|
||||
</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"/>
|
||||
<library name="wsf_standalone" location="..\connector\standalone-safe.ecf"/>
|
||||
<cluster name="default_standalone" location=".\standalone\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
17
library/server/wsf/default/standalone.ecf
Normal file
17
library/server/wsf/default/standalone.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_standalone" uuid="5CBA8C5A-3191-434A-8DE1-C0C3CAC9C4F4" library_target="default_standalone">
|
||||
<target name="default_standalone">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" void_safety="none" syntax="provisional">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="wsf" location="..\wsf.ecf"/>
|
||||
<library name="wsf_standalone" location="..\connector\standalone.ecf"/>
|
||||
<cluster name="default_standalone" location=".\standalone\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,6 +1,6 @@
|
||||
note
|
||||
description: "[
|
||||
Default launcher for WSF_SERVICE based on {WSF_HTTPD_SERVICE_LAUNCHER}
|
||||
Default launcher for WSF_SERVICE based on {WSF_STANDALONE_SERVICE_LAUNCHER}
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -9,7 +9,7 @@ class
|
||||
WSF_DEFAULT_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_HTTPD_SERVICE_LAUNCHER [G]
|
||||
WSF_STANDALONE_SERVICE_LAUNCHER [G]
|
||||
|
||||
create
|
||||
make,
|
||||
92
library/server/wsf/router/filter/wsf_filtered_execution.e
Normal file
92
library/server/wsf/router/filter/wsf_filtered_execution.e
Normal file
@@ -0,0 +1,92 @@
|
||||
note
|
||||
description: "Summary description for {WSF_FILTERED_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_FILTERED_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
initialize_filter
|
||||
end
|
||||
|
||||
initialize_filter
|
||||
-- Initialize `filter'
|
||||
do
|
||||
create_filter
|
||||
setup_filter
|
||||
end
|
||||
|
||||
create_filter
|
||||
-- Create `filter'
|
||||
deferred
|
||||
ensure
|
||||
filter_created: filter /= Void
|
||||
end
|
||||
|
||||
setup_filter
|
||||
-- Setup `filter'
|
||||
require
|
||||
filter_created: filter /= Void
|
||||
deferred
|
||||
end
|
||||
|
||||
append_filters (a_filters: ITERABLE [WSF_FILTER])
|
||||
-- Append collection `a_filters' of filters to the end of the `filter' chain.
|
||||
local
|
||||
f: like filter
|
||||
l_next_filter: detachable like filter
|
||||
do
|
||||
from
|
||||
f := filter
|
||||
l_next_filter := f.next
|
||||
until
|
||||
l_next_filter = Void
|
||||
loop
|
||||
f := l_next_filter
|
||||
l_next_filter := f.next
|
||||
end
|
||||
check f_attached_without_next: f /= Void and then f.next = Void end
|
||||
across
|
||||
a_filters as ic
|
||||
loop
|
||||
l_next_filter := ic.item
|
||||
f.set_next (l_next_filter)
|
||||
f := l_next_filter
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
filter: WSF_FILTER
|
||||
-- Filter
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
do
|
||||
filter.execute (request, response)
|
||||
end
|
||||
|
||||
;note
|
||||
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)"
|
||||
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
|
||||
@@ -48,7 +48,7 @@ feature -- Execution
|
||||
create l_sess
|
||||
router.dispatch (req, res, l_sess)
|
||||
if not l_sess.dispatched then
|
||||
execute_default
|
||||
execute_default (req, res)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -279,7 +279,7 @@ invariant
|
||||
unavailability_duration_xor_unavailable_until: unavailability_duration > 0 implies unavailable_until = Void
|
||||
|
||||
;note
|
||||
copyright: "2011-2013, 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)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
68
library/server/wsf/router/wsf_filtered_routed_execution.e
Normal file
68
library/server/wsf/router/wsf_filtered_routed_execution.e
Normal file
@@ -0,0 +1,68 @@
|
||||
note
|
||||
description: "[
|
||||
Execution which is first filtered, and then pass to the router
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_FILTERED_ROUTED_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_FILTERED_EXECUTION
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
WSF_ROUTED_EXECUTION
|
||||
undefine
|
||||
execute
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
WSF_FILTER
|
||||
rename
|
||||
execute as filter_execute
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialize
|
||||
|
||||
initialize
|
||||
local
|
||||
f: like filter
|
||||
do
|
||||
Precursor {WSF_ROUTED_EXECUTION}
|
||||
Precursor {WSF_FILTERED_EXECUTION}
|
||||
-- Current is a WSF_FILTER as well in order to call the router
|
||||
-- let's add Current at the end of the filter chain.
|
||||
from
|
||||
f := filter
|
||||
until
|
||||
not attached f.next as l_next
|
||||
loop
|
||||
f := l_next
|
||||
end
|
||||
f.set_next (Current)
|
||||
end
|
||||
|
||||
feature -- Execute Filter
|
||||
|
||||
filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the filter.
|
||||
do
|
||||
router_execute (req, res)
|
||||
end
|
||||
|
||||
note
|
||||
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)"
|
||||
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,6 +7,20 @@ note
|
||||
deferred class
|
||||
WSF_ROUTED_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialize
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
initialize_router
|
||||
end
|
||||
|
||||
feature -- Router
|
||||
|
||||
initialize_router
|
||||
@@ -34,14 +48,6 @@ feature -- Router
|
||||
|
||||
feature -- Access
|
||||
|
||||
request: WSF_REQUEST
|
||||
deferred
|
||||
end
|
||||
|
||||
response: WSF_RESPONSE
|
||||
deferred
|
||||
end
|
||||
|
||||
router: WSF_ROUTER
|
||||
-- Router used to dispatch the request according to the WSF_REQUEST object
|
||||
-- and associated request methods
|
||||
@@ -51,19 +57,22 @@ feature -- Execution
|
||||
execute
|
||||
-- Dispatch the request
|
||||
-- and if handler is not found, execute the default procedure `execute_default'.
|
||||
do
|
||||
router_execute (request, response)
|
||||
end
|
||||
|
||||
router_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
sess: WSF_ROUTER_SESSION
|
||||
do
|
||||
create sess
|
||||
router.dispatch (request, response, sess)
|
||||
router.dispatch (req, res, sess)
|
||||
if not sess.dispatched then
|
||||
execute_default
|
||||
execute_default (req, res)
|
||||
end
|
||||
ensure
|
||||
response_status_is_set: response.status_is_set
|
||||
end
|
||||
|
||||
execute_default
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Dispatch requests without a matching handler.
|
||||
local
|
||||
msg: WSF_DEFAULT_ROUTER_RESPONSE
|
||||
@@ -73,4 +82,14 @@ feature -- Execution
|
||||
response.send (msg)
|
||||
end
|
||||
|
||||
note
|
||||
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)"
|
||||
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,31 +1,22 @@
|
||||
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
|
||||
]"
|
||||
description: "Summary description for {WSF_EXECUTION_FACTORY}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_RESPONSE_SERVICE [G -> WSF_EXECUTION create make end]
|
||||
WSF_EXECUTION_FACTORY
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Response
|
||||
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
deferred
|
||||
ensure
|
||||
Result_attached: Result /= Void
|
||||
WGI_EXECUTION_FACTORY
|
||||
redefine
|
||||
execution
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
feature -- Factory
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
res.send (response (req))
|
||||
execution (req: WGI_REQUEST; res: WGI_RESPONSE): WSF_EXECUTION
|
||||
deferred
|
||||
end
|
||||
|
||||
note
|
||||
@@ -19,7 +19,7 @@ note
|
||||
class
|
||||
WSF_RESPONSE
|
||||
|
||||
create {WSF_TO_WGI_SERVICE, WSF_EXECUTION, WGI_EXPORTER}
|
||||
create {WSF_EXECUTION, WGI_EXPORTER}
|
||||
make_from_wgi
|
||||
|
||||
create {WSF_RESPONSE}
|
||||
|
||||
@@ -8,7 +8,7 @@ class
|
||||
ECHO_SERVER
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
WSF_DEFAULT_SERVICE [ECHO_SERVER_EXECUTION]
|
||||
|
||||
create
|
||||
make
|
||||
@@ -23,53 +23,4 @@ feature {NONE} -- Initialization
|
||||
make_and_launch
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
page: WSF_PAGE_RESPONSE
|
||||
l_body: STRING_8
|
||||
do
|
||||
create l_body.make (1024)
|
||||
create page.make_with_body (l_body)
|
||||
page.header.put_content_type_text_plain
|
||||
|
||||
l_body.append ("REQUEST_METHOD=" + req.request_method + "%N")
|
||||
l_body.append ("REQUEST_URI=" + req.request_uri + "%N")
|
||||
l_body.append ("PATH_INFO=" + req.path_info + "%N")
|
||||
l_body.append ("QUERY_STRING=" + req.query_string + "%N")
|
||||
|
||||
l_body.append ("Query parameters:%N")
|
||||
across
|
||||
req.query_parameters as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
l_body.append ("Form parameters:%N")
|
||||
across
|
||||
req.form_parameters as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
l_body.append ("Meta variables:%N")
|
||||
across
|
||||
req.meta_variables as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
res.send (page)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
feature -- Change
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
invariant
|
||||
-- invariant_clause: True
|
||||
|
||||
end
|
||||
|
||||
59
library/server/wsf/tests/echo/src/echo_server_execution.e
Normal file
59
library/server/wsf/tests/echo/src/echo_server_execution.e
Normal file
@@ -0,0 +1,59 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
ECHO_SERVER_EXECUTION
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
local
|
||||
req: WSF_REQUEST; res: WSF_RESPONSE
|
||||
page: WSF_PAGE_RESPONSE
|
||||
l_body: STRING_8
|
||||
do
|
||||
req := request
|
||||
res := response
|
||||
create l_body.make (1024)
|
||||
create page.make_with_body (l_body)
|
||||
page.header.put_content_type_text_plain
|
||||
|
||||
l_body.append ("REQUEST_METHOD=" + req.request_method + "%N")
|
||||
l_body.append ("REQUEST_URI=" + req.request_uri + "%N")
|
||||
l_body.append ("PATH_INFO=" + req.path_info + "%N")
|
||||
l_body.append ("QUERY_STRING=" + req.query_string + "%N")
|
||||
|
||||
l_body.append ("Query parameters:%N")
|
||||
across
|
||||
req.query_parameters as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
l_body.append ("Form parameters:%N")
|
||||
across
|
||||
req.form_parameters as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
l_body.append ("Meta variables:%N")
|
||||
across
|
||||
req.meta_variables as q
|
||||
loop
|
||||
l_body.append ("%T"+ q.item.name + "=" + q.item.string_representation +"%N")
|
||||
end
|
||||
|
||||
res.send (page)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,9 +2,9 @@ class
|
||||
TEST
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
WSF_DEFAULT_SERVICE [TEST_EXECUTION]
|
||||
|
||||
TEST_SERVICE
|
||||
TEST_SERVICE [TEST_EXECUTION]
|
||||
|
||||
create
|
||||
make
|
||||
@@ -22,38 +22,6 @@ feature {NONE} -- Initialization
|
||||
make_and_launch
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
server_log_path: STRING
|
||||
local
|
||||
fn: FILE_NAME
|
||||
once
|
||||
create fn.make_from_string ("server_test.log")
|
||||
Result := fn.string
|
||||
end
|
||||
|
||||
server_log (m: STRING_8)
|
||||
local
|
||||
f: RAW_FILE
|
||||
do
|
||||
create f.make (server_log_path)
|
||||
f.open_append
|
||||
f.put_string (m)
|
||||
f.put_character ('%N')
|
||||
f.close
|
||||
end
|
||||
|
||||
base_url: detachable STRING
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
local
|
||||
b: like base_url
|
||||
do
|
||||
b := base_url
|
||||
if b = Void then
|
||||
b := ""
|
||||
end
|
||||
Result := "/" + b + a_query_url
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
51
library/server/wsf/tests/server/test_execution.e
Normal file
51
library/server/wsf/tests/server/test_execution.e
Normal file
@@ -0,0 +1,51 @@
|
||||
note
|
||||
description: "Summary description for {}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_EXECUTION
|
||||
|
||||
inherit
|
||||
TEST_EXECUTION_I
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Helper
|
||||
|
||||
server_log_path: STRING
|
||||
local
|
||||
fn: FILE_NAME
|
||||
once
|
||||
create fn.make_from_string ("server_test.log")
|
||||
Result := fn.string
|
||||
end
|
||||
|
||||
server_log (m: STRING_8)
|
||||
local
|
||||
f: RAW_FILE
|
||||
do
|
||||
create f.make (server_log_path)
|
||||
f.open_append
|
||||
f.put_string (m)
|
||||
f.put_character ('%N')
|
||||
f.close
|
||||
end
|
||||
|
||||
base_url: detachable STRING
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
local
|
||||
b: like base_url
|
||||
do
|
||||
b := base_url
|
||||
if b = Void then
|
||||
b := ""
|
||||
end
|
||||
Result := "/" + b + a_query_url
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
195
library/server/wsf/tests/server/test_execution_i.e
Normal file
195
library/server/wsf/tests/server/test_execution_i.e
Normal file
@@ -0,0 +1,195 @@
|
||||
note
|
||||
description: "Summary description for {}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
TEST_EXECUTION_I
|
||||
|
||||
inherit
|
||||
WSF_EXECUTION
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
local
|
||||
req: WSF_REQUEST
|
||||
res: WSF_RESPONSE
|
||||
q: detachable STRING_32
|
||||
n: NATURAL_64
|
||||
page: WSF_PAGE_RESPONSE
|
||||
log_res: WSF_LOGGER_RESPONSE_WRAPPER
|
||||
do
|
||||
req := request
|
||||
res := response
|
||||
debug
|
||||
server_log (req.request_uri)
|
||||
if attached req.content_type as l_content_type then
|
||||
server_log ("content_type:" + l_content_type.string)
|
||||
end
|
||||
end
|
||||
if attached req.http_expect as l_expect and then l_expect.same_string ("100-continue") then
|
||||
(create {EXECUTION_ENVIRONMENT}).sleep (900_000_000) -- 900 milliseconds
|
||||
end
|
||||
|
||||
create page.make
|
||||
if attached req.request_uri as l_uri then
|
||||
if l_uri.starts_with (test_url ("get/01")) then
|
||||
page.set_status_code (200)
|
||||
page.header.put_content_type_text_plain
|
||||
page.put_string ("get-01")
|
||||
create q.make_empty
|
||||
|
||||
across
|
||||
req.query_parameters as qcur
|
||||
loop
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.string_representation)
|
||||
end
|
||||
if not q.is_empty then
|
||||
page.put_string ("(" + q + ")")
|
||||
end
|
||||
elseif l_uri.starts_with (test_url ("post/01")) then
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("post-01")
|
||||
create q.make_empty
|
||||
|
||||
across
|
||||
req.query_parameters as qcur
|
||||
loop
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.string_representation)
|
||||
end
|
||||
|
||||
if not q.is_empty then
|
||||
page.put_string ("(" + q + ")")
|
||||
end
|
||||
|
||||
create q.make_empty
|
||||
-- req.set_raw_input_data_recorded (True)
|
||||
|
||||
across
|
||||
req.form_parameters as fcur
|
||||
loop
|
||||
debug
|
||||
server_log ("%Tform: " + fcur.item.name)
|
||||
end
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (fcur.item.name.as_string_32 + "=" + fcur.item.string_representation)
|
||||
end
|
||||
|
||||
-- if attached req.raw_input_data as d then
|
||||
-- server_log ("Raw data=" + d)
|
||||
-- end
|
||||
|
||||
if not q.is_empty then
|
||||
page.put_string (" : " + q )
|
||||
end
|
||||
elseif l_uri.starts_with (test_url ("post/file/01")) then
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("post-file-01")
|
||||
n := req.content_length_value
|
||||
if n > 0 then
|
||||
req.input.read_string (n.to_integer_32)
|
||||
q := req.input.last_string
|
||||
page.put_string ("%N" + q)
|
||||
end
|
||||
else
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("Hello")
|
||||
end
|
||||
else
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("Bye")
|
||||
end
|
||||
|
||||
if
|
||||
attached new_file (req, "output.log") as l_out and
|
||||
attached new_file (req, "error.log") as l_err
|
||||
then
|
||||
create log_res.make_from_response (res, l_out, l_err)
|
||||
log_res.send (page)
|
||||
|
||||
l_out.close
|
||||
l_err.close
|
||||
else
|
||||
check False end
|
||||
res.send (page)
|
||||
end
|
||||
end
|
||||
|
||||
new_file (req: WSF_REQUEST; a_suffix: STRING): detachable FILE
|
||||
local
|
||||
dp, p, fp: FILE_NAME
|
||||
d: DIRECTORY
|
||||
i: INTEGER
|
||||
f: detachable FILE
|
||||
retried: INTEGER
|
||||
do
|
||||
if retried = 0 then
|
||||
create dp.make_from_string ("logs")
|
||||
create d.make (dp.string)
|
||||
if not d.exists then
|
||||
d.recursive_create_dir
|
||||
end
|
||||
if attached req.request_time_stamp as t then
|
||||
create p.make_from_string (t.out)
|
||||
else
|
||||
create p.make_from_string ("")
|
||||
end
|
||||
|
||||
from
|
||||
i := 0
|
||||
create fp.make_from_string (dp.string)
|
||||
if p.is_empty then
|
||||
fp.set_file_name (p.string + a_suffix)
|
||||
else
|
||||
fp.set_file_name (p.string + "-" + a_suffix)
|
||||
end
|
||||
create {PLAIN_TEXT_FILE} f.make (fp.string)
|
||||
until
|
||||
not f.exists
|
||||
loop
|
||||
i := i + 1
|
||||
create fp.make_from_string (dp.string)
|
||||
if p.is_empty then
|
||||
fp.set_file_name (p.string + i.out + "-" + a_suffix)
|
||||
else
|
||||
fp.set_file_name (p.string + "_" + i.out + "-" + a_suffix)
|
||||
end
|
||||
|
||||
f.make (fp.string)
|
||||
end
|
||||
f.open_write
|
||||
elseif retried < 5 then
|
||||
|
||||
-- Eventually another request created the file at the same time ..
|
||||
f := new_file (req, a_suffix)
|
||||
else
|
||||
f := Void
|
||||
end
|
||||
Result := f
|
||||
rescue
|
||||
retried := retried + 1
|
||||
retry
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
server_log (s: STRING)
|
||||
deferred
|
||||
end
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -5,187 +5,11 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
TEST_SERVICE
|
||||
TEST_SERVICE [G -> TEST_EXECUTION_I create make end]
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
q: detachable STRING_32
|
||||
n: NATURAL_64
|
||||
page: WSF_PAGE_RESPONSE
|
||||
log_res: WSF_LOGGER_RESPONSE_WRAPPER
|
||||
do
|
||||
debug
|
||||
server_log (req.request_uri)
|
||||
if attached req.content_type as l_content_type then
|
||||
server_log ("content_type:" + l_content_type.string)
|
||||
end
|
||||
end
|
||||
if attached req.http_expect as l_expect and then l_expect.same_string ("100-continue") then
|
||||
(create {EXECUTION_ENVIRONMENT}).sleep (900_000_000) -- 900 milliseconds
|
||||
end
|
||||
|
||||
create page.make
|
||||
if attached req.request_uri as l_uri then
|
||||
if l_uri.starts_with (test_url ("get/01")) then
|
||||
page.set_status_code (200)
|
||||
page.header.put_content_type_text_plain
|
||||
page.put_string ("get-01")
|
||||
create q.make_empty
|
||||
|
||||
across
|
||||
req.query_parameters as qcur
|
||||
loop
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.string_representation)
|
||||
end
|
||||
if not q.is_empty then
|
||||
page.put_string ("(" + q + ")")
|
||||
end
|
||||
elseif l_uri.starts_with (test_url ("post/01")) then
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("post-01")
|
||||
create q.make_empty
|
||||
|
||||
across
|
||||
req.query_parameters as qcur
|
||||
loop
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.string_representation)
|
||||
end
|
||||
|
||||
if not q.is_empty then
|
||||
page.put_string ("(" + q + ")")
|
||||
end
|
||||
|
||||
create q.make_empty
|
||||
-- req.set_raw_input_data_recorded (True)
|
||||
|
||||
across
|
||||
req.form_parameters as fcur
|
||||
loop
|
||||
debug
|
||||
server_log ("%Tform: " + fcur.item.name)
|
||||
end
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (fcur.item.name.as_string_32 + "=" + fcur.item.string_representation)
|
||||
end
|
||||
|
||||
-- if attached req.raw_input_data as d then
|
||||
-- server_log ("Raw data=" + d)
|
||||
-- end
|
||||
|
||||
if not q.is_empty then
|
||||
page.put_string (" : " + q )
|
||||
end
|
||||
elseif l_uri.starts_with (test_url ("post/file/01")) then
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("post-file-01")
|
||||
n := req.content_length_value
|
||||
if n > 0 then
|
||||
req.input.read_string (n.to_integer_32)
|
||||
q := req.input.last_string
|
||||
page.put_string ("%N" + q)
|
||||
end
|
||||
else
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("Hello")
|
||||
end
|
||||
else
|
||||
page.put_header (200, <<["Content-Type", "text/plain"]>>)
|
||||
page.put_string ("Bye")
|
||||
end
|
||||
|
||||
if
|
||||
attached new_file (req, "output.log") as l_out and
|
||||
attached new_file (req, "error.log") as l_err
|
||||
then
|
||||
create log_res.make_from_response (res, l_out, l_err)
|
||||
log_res.send (page)
|
||||
|
||||
l_out.close
|
||||
l_err.close
|
||||
else
|
||||
check False end
|
||||
res.send (page)
|
||||
end
|
||||
end
|
||||
|
||||
new_file (req: WSF_REQUEST; a_suffix: STRING): detachable FILE
|
||||
local
|
||||
dp, p, fp: FILE_NAME
|
||||
d: DIRECTORY
|
||||
i: INTEGER
|
||||
f: detachable FILE
|
||||
retried: INTEGER
|
||||
do
|
||||
if retried = 0 then
|
||||
create dp.make_from_string ("logs")
|
||||
create d.make (dp.string)
|
||||
if not d.exists then
|
||||
d.recursive_create_dir
|
||||
end
|
||||
if attached req.request_time_stamp as t then
|
||||
create p.make_from_string (t.out)
|
||||
else
|
||||
create p.make_from_string ("")
|
||||
end
|
||||
|
||||
from
|
||||
i := 0
|
||||
create fp.make_from_string (dp.string)
|
||||
if p.is_empty then
|
||||
fp.set_file_name (p.string + a_suffix)
|
||||
else
|
||||
fp.set_file_name (p.string + "-" + a_suffix)
|
||||
end
|
||||
create {PLAIN_TEXT_FILE} f.make (fp.string)
|
||||
until
|
||||
not f.exists
|
||||
loop
|
||||
i := i + 1
|
||||
create fp.make_from_string (dp.string)
|
||||
if p.is_empty then
|
||||
fp.set_file_name (p.string + i.out + "-" + a_suffix)
|
||||
else
|
||||
fp.set_file_name (p.string + "_" + i.out + "-" + a_suffix)
|
||||
end
|
||||
|
||||
f.make (fp.string)
|
||||
end
|
||||
f.open_write
|
||||
elseif retried < 5 then
|
||||
|
||||
-- Eventually another request created the file at the same time ..
|
||||
f := new_file (req, a_suffix)
|
||||
else
|
||||
f := Void
|
||||
end
|
||||
Result := f
|
||||
rescue
|
||||
retried := retried + 1
|
||||
retry
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
server_log (s: STRING)
|
||||
deferred
|
||||
end
|
||||
|
||||
test_url (a_query_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -17,14 +17,9 @@ inherit
|
||||
on_clean
|
||||
end
|
||||
|
||||
TEST_SERVICE
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature {NONE} -- Events
|
||||
|
||||
web_app: detachable NINO_SERVICE
|
||||
web_app: detachable NINO_SERVICE [TEST_EXECUTION]
|
||||
|
||||
port_number: INTEGER
|
||||
base_url: detachable STRING
|
||||
@@ -32,7 +27,7 @@ feature {NONE} -- Events
|
||||
on_prepare
|
||||
-- <Precursor>
|
||||
local
|
||||
app: NINO_SERVICE
|
||||
app: NINO_SERVICE [TEST_EXECUTION]
|
||||
wt: WORKER_THREAD
|
||||
e: EXECUTION_ENVIRONMENT
|
||||
do
|
||||
@@ -43,7 +38,7 @@ feature {NONE} -- Events
|
||||
|
||||
port_number := 0
|
||||
base_url := "/test/"
|
||||
create app.make_custom (to_wgi_service, base_url)
|
||||
create app.make_custom (base_url)
|
||||
web_app := app
|
||||
|
||||
create wt.make (agent app.listen (port_number))
|
||||
|
||||
@@ -7,15 +7,13 @@ class
|
||||
TEST_WSF_RESPONSE_TEST_SUITE
|
||||
|
||||
inherit
|
||||
WSF_TO_WGI_SERVICE
|
||||
rename
|
||||
default_create as df_wgi,
|
||||
execute as execute_wgi
|
||||
end
|
||||
EQA_TEST_SET
|
||||
redefine
|
||||
on_prepare
|
||||
select
|
||||
end
|
||||
|
||||
WGI_EXPORTER
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
@@ -23,7 +21,6 @@ feature {NONE} -- Events
|
||||
|
||||
on_prepare
|
||||
do
|
||||
make_from_service (create {WSF_SERVICE_NULL})
|
||||
end
|
||||
|
||||
feature -- Test Cases
|
||||
@@ -96,7 +93,7 @@ feature -- Test Cases
|
||||
end
|
||||
|
||||
|
||||
test_add_multiple_cookie_with_similar_cookie_name_2
|
||||
test_add_multiple_cookie_with_similar_cookie_name_2
|
||||
local
|
||||
w_res: WSF_RESPONSE
|
||||
l_cookie: WSF_COOKIE
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Mock implementation of the WGI_SERVICE interface.
|
||||
|
||||
Used for testing the ewf core and also web applications
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_SERVICE_NULL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_SERVICE
|
||||
|
||||
|
||||
feature -- Execute
|
||||
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
|
||||
do
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user