diff --git a/library/server/ewsgi/connectors/nino/src/gw_nino_application.e b/library/server/ewsgi/connectors/nino/src/gw_nino_application.e
new file mode 100644
index 00000000..1247261c
--- /dev/null
+++ b/library/server/ewsgi/connectors/nino/src/gw_nino_application.e
@@ -0,0 +1,64 @@
+note
+ description: "Summary description for {GW_NINO_APPLICATION}."
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ GW_NINO_APPLICATION
+
+create
+ make,
+ make_custom
+
+feature {NONE} -- Implementation
+
+ make (a_callback: like {GW_AGENT_APPLICATION}.callback)
+ -- Initialize `Current'.
+ do
+ make_custom (a_callback, Void)
+ end
+
+ make_custom (a_callback: like {GW_AGENT_APPLICATION}.callback; a_base_url: detachable STRING)
+ -- Initialize `Current'.
+ local
+ app: GW_AGENT_APPLICATION
+ do
+ create app.make (a_callback)
+ create connector.make_with_base (app, a_base_url)
+ end
+
+ connector: GW_NINO_CONNECTOR
+ -- Web server connector
+
+feature -- Status settings
+
+ configuration: HTTP_SERVER_CONFIGURATION
+ do
+ Result := connector.configuration
+ end
+
+ force_single_threaded
+ -- Force single threaded behavior
+ do
+ configuration.force_single_threaded := True
+ end
+
+feature -- Server
+
+ listen (a_port: INTEGER)
+ do
+ configuration.http_server_port := a_port
+ connector.launch
+ end
+
+note
+ copyright: "2011-2011, 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
diff --git a/library/server/ewsgi/examples/hello_world/hello-safe.ecf b/library/server/ewsgi/examples/hello_world/hello-safe.ecf
index bc9bc974..76cdb452 100644
--- a/library/server/ewsgi/examples/hello_world/hello-safe.ecf
+++ b/library/server/ewsgi/examples/hello_world/hello-safe.ecf
@@ -9,11 +9,10 @@
+
-
-
-
+
diff --git a/library/server/ewsgi/examples/hello_world/src/hello_world.e b/library/server/ewsgi/examples/hello_world/src/hello_world.e
index a9add13c..ec9d3eaf 100644
--- a/library/server/ewsgi/examples/hello_world/src/hello_world.e
+++ b/library/server/ewsgi/examples/hello_world/src/hello_world.e
@@ -7,53 +7,23 @@ note
class
HELLO_WORLD
-inherit
- GW_APPLICATION_IMP
-
create
make
feature {NONE} -- Initialization
make
- -- Initialize `Current'.
- local
- conn: detachable GW_CONNECTOR
- nino_conn: GW_NINO_CONNECTOR
do
- if is_nino then
- create nino_conn.make_with_base (Current, "/hello_world")
- if attached nino_conn.server.server_configuration as cfg then
- cfg.http_server_port := 8080
- cfg.force_single_threaded := True
+ print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:8123/%N")
+ (create {GW_NINO_APPLICATION}.make (agent (ctx: GW_REQUEST_CONTEXT)
+ do
+ ctx.output.put_header (200, <<["Content-Type", "text/plain"]>>)
+ ctx.output.put_string ("Hello World!%N")
end
- conn := nino_conn
- elseif is_cgi then
- create {GW_CGI_CONNECTOR} conn.make (Current)
- elseif is_libfcgi then
- create {GW_LIBFCGI_CONNECTOR} conn.make (Current)
- else
- io.error.put_string ("Unsupported connector")
- end
- if conn /= Void then
- conn.launch
- end
+ )).listen (port_number)
end
- is_nino: BOOLEAN = True
- is_cgi: BOOLEAN = False
- is_libfcgi: BOOLEAN = False
-
-feature -- Execution
-
- execute (ctx: GW_REQUEST_CONTEXT)
- -- Execute the request
- do
- ctx.output.put_string ("Hello World!%N")
- if attached ctx.execution_variable ("REQUEST_COUNT") as rq_count then
- ctx.output.put_string ("Request #" + rq_count + "%N")
- end
- end
+ port_number: INTEGER = 8123
note
copyright: "2011-2011, Eiffel Software and others"
diff --git a/library/server/ewsgi/src/implementation/gw_agent_application.e b/library/server/ewsgi/src/implementation/gw_agent_application.e
new file mode 100644
index 00000000..8654543a
--- /dev/null
+++ b/library/server/ewsgi/src/implementation/gw_agent_application.e
@@ -0,0 +1,48 @@
+note
+ description: "Summary description for {GW_AGENT_APPLICATION}."
+ author: ""
+ date: "$Date$"
+ revision: "$Revision$"
+
+class
+ GW_AGENT_APPLICATION
+
+inherit
+ GW_APPLICATION_IMP
+
+create
+ make
+
+feature {NONE} -- Implementation
+
+ make (a_callback: like callback)
+ -- Initialize `Current'.
+ do
+ callback := a_callback
+ end
+
+feature {NONE} -- Implementation
+
+ callback: PROCEDURE [ANY, TUPLE [like new_request_context]]
+ -- Procedure called on `execute'
+
+ execute (ctx: like new_request_context)
+ -- Execute the request
+ do
+ callback.call ([ctx])
+ end
+
+invariant
+ callback_attached: callback /= Void
+
+note
+ copyright: "2011-2011, 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