First integration of the new GW_ design more centralized on connector, and does not require specific feature on GW_APPLICATION depending on the connector.
So this is really more flexible this way, and much easier to write application supporting CGI, FCGI, Nino and so on .. as demonstrated in hello_world This is a first version, more will come later, mainly migrating from Eiffel Web Reloaded to this Eiffel Web Framework project.
This commit is contained in:
19
library/server/ewsgi/examples/hello_world/hello-safe.ecf
Normal file
19
library/server/ewsgi/examples/hello_world/hello-safe.ecf
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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="hello_world" uuid="734385F1-0D17-4B5F-9138-24DC8D4F06C6">
|
||||
<target name="hello_world">
|
||||
<root class="HELLO_WORLD" feature="make"/>
|
||||
<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="ewsgi" location="..\..\ewsgi-safe.ecf" readonly="false"/>
|
||||
<library name="connector_cgi" location="..\..\connectors\cgi\cgi-safe.ecf" readonly="false"/>
|
||||
<library name="connector_nino" location="..\..\connectors\nino\nino-safe.ecf" readonly="false"/>
|
||||
<library name="connector_libfcgi" location="..\..\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location="src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
58
library/server/ewsgi/examples/hello_world/src/hello_world.e
Normal file
58
library/server/ewsgi/examples/hello_world/src/hello_world.e
Normal file
@@ -0,0 +1,58 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user