Migrated most of the example and library to new design.

This commit is contained in:
2015-03-31 14:50:20 +02:00
parent 7d2ce8a77f
commit 4907bc3085
124 changed files with 2399 additions and 1789 deletions

View File

@@ -17,22 +17,28 @@
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>{/if}
{if condition="$WIZ.connectors.use_nino ~ $WIZ_YES"}<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>{/if}
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/default$</exclude>
</file_rule>
<cluster name="any_launcher" location="$|any"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
<target name="{$WIZ.project.name/}_standalone" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
<cluster name="launcher" location=".\launcher\">
<cluster name="default_launcher" location="$|default"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
{if condition="$WIZ.connectors.use_nino ~ $WIZ_YES"}
<target name="{$WIZ.project.name/}_nino" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
<cluster name="launcher" location=".\launcher\">
<cluster name="default_launcher" location="$|default"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
@@ -40,10 +46,8 @@
<target name="{$WIZ.project.name/}_cgi" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
<cluster name="launcher" location=".\launcher\">
<cluster name="default_launcher" location="$|default"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}
@@ -51,10 +55,8 @@
<target name="{$WIZ.project.name/}_libfcgi" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\" recursive="true">
<file_rule>
<exclude>/any$</exclude>
</file_rule>
<cluster name="launcher" location=".\launcher\">
<cluster name="default_launcher" location="$|default"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>
</target>{/if}

View File

@@ -10,33 +10,38 @@ note
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
inherit
SHARED_EXECUTION_ENVIRONMENT
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using `a_service' and optionals `opts'.
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using optionals `opts'.
local
l_id: like launcher_id
launcher: WSF_SERVICE_LAUNCHER
do
l_id := launcher_id
if l_id = Void then
if not attached launcher_id as l_id then
{unless condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
io.error.put_string ("Application launcher not found!%N")
(create {EXCEPTIONS}).die (-1){/literal}{/unless}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
-- Choose a default -> standalone
create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
elseif is_libfcgi_launcher_id (l_id) then
create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
elseif is_cgi_launcher_id (l_id) then
create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
elseif is_nino_launcher_id (l_id) then
create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}{/if}
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}{literal}
elseif is_libfcgi_launcher_id (l_id) then
create {WSF_LIBFCGI_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}{literal}
elseif is_cgi_launcher_id (l_id) then
create {WSF_CGI_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_nino ~ $WIZ_YES"}{literal}
elseif is_nino_launcher_id (l_id) then
create {WSF_NINO_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
{literal}
else
io.error.put_string ("Application launcher not found!%N")
@@ -48,11 +53,8 @@ feature -- Execution
-- Launcher id based on the executable extension name if any.
-- This can be redefine to customize for your application.
--| ex: nino, cgi, libfcgi or Void.
local
sh_exec: SHARED_EXECUTION_ENVIRONMENT
do
create sh_exec
if attached (create {PATH}.make_from_string (sh_exec.execution_environment.arguments.command_name)).extension as ext then
if attached (create {PATH}.make_from_string (execution_environment.arguments.command_name)).extension as ext then
Result := ext
end
end
@@ -60,10 +62,15 @@ feature -- Execution
feature -- Status report
{/literal}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
is_nino_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("standalone")
end{/if}
{if condition="$WIZ.connectors.use_nino ~ $WIZ_YES"}
is_nino_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("nino")
or a_id.is_case_insensitive ("standalone")
end{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
@@ -79,6 +86,5 @@ feature -- Status report
or a_id.is_case_insensitive ("fcgi")
end{/if}
end

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G]
feature -- Custom

View File

@@ -10,21 +10,21 @@ note
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using `a_service' and optionals `opts'.
local
launcher: WSF_SERVICE_LAUNCHER
launcher: WSF_SERVICE_LAUNCHER [G]
do
{literal}
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts){/literal}
create {WSF_DEFAULT_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}
end
launcher_id: detachable READABLE_STRING_GENERAL
do
once
-- Not used for default connector selection.
end

View File

@@ -16,8 +16,8 @@ inherit
end
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
WSF_ROUTED_SERVICE{/if}
APPLICATION_LAUNCHER
{if isset="$APP_ROOT"}APPLICATION_LAUNCHER [{$APP_ROOT/}_EXECUTION]{/if}
{unless isset="$APP_ROOT"}APPLICATION_LAUNCHER [APPLICATION_EXECUTION]{/if}
{literal}create
make_and_launch
@@ -29,27 +29,7 @@ feature {NONE} -- Initialization
do
Precursor
set_service_option ("port", {$WIZ.standalone_connector.port/})
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
end{/unless}
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
initialize_router
end
setup_router
-- Setup `router'
local
fhdl: WSF_FILE_SYSTEM_HANDLER
do
router.handle_with_request_methods ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
create fhdl.make_hidden ("www")
fhdl.set_directory_index (<<"index.html">>)
router.handle_with_request_methods ("", fhdl, router.methods_GET)
end{/literal}{/if}
end

View File

@@ -0,0 +1,89 @@
note
description: "[
application execution
]"
date: "$Date$"
revision: "$Revision$"
class
{if isset="$APP_ROOT"}{$APP_ROOT/}_EXECUTION{/if}
{unless isset="$APP_ROOT"}APPLICATION_EXECUTION{/unless}
inherit
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
{unless condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
WSF_EXECUTION{/unless}
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
WSF_FILTERED_EXECUTION{/if}
{/unless}
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
{unless condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
WSF_ROUTED_EXECUTION{/unless}
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
WSF_FILTERED_ROUTED_EXECUTION{/if}
{/if}
{literal}create
make
feature {NONE} -- Initialization
{/literal}
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
feature -- Execution
execute
-- Use `request' to get data for the incoming http request
-- and `response' to send response back to the client
local
mesg: WSF_PAGE_RESPONSE
do
--| As example, you can use {WSF_PAGE_RESPONSE}
--| To send back easily a simple plaintext message.
create mesg.make_with_body ("Hello Eiffel Web")
response.send (mesg)
end{/unless}
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}{literal}
feature -- Filter
create_filter
-- Create `filter'
do
--| Example using Maintenance filter.
create {WSF_MAINTENANCE_FILTER} filter
end
setup_filter
-- Setup `filter'
do
append_filters (<<
create {WSF_CORS_FILTER},
create {WSF_LOGGING_FILTER}
>>)
--| Chain more filters like {WSF_CUSTOM_HEADER_FILTER}, ...
--| and your owns filters.
end{/if}
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
feature -- Router
setup_router
-- Setup `router'
local
fhdl: WSF_FILE_SYSTEM_HANDLER
do
--| As example:
--| /doc is dispatched to self documentated page
--| /* are dispatched to serve files/directories contained in "www" directory
--| Self documentation
router.handle_with_request_methods ("/doc", create {WSF_ROUTER_SELF_DOCUMENTATION_HANDLER}.make (router), router.methods_GET)
--| Files publisher
create fhdl.make_hidden ("www")
fhdl.set_directory_index (<<"index.html">>)
router.handle_with_request_methods ("", fhdl, router.methods_GET)
end{/literal}{/if}
end