Migrated most of the example and library to new design.
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -24,7 +24,7 @@ feature -- Factory
|
||||
create Result.make (Current)
|
||||
end
|
||||
|
||||
feature -- Pages
|
||||
feature -- Pages
|
||||
|
||||
first_page: WIZARD_PAGE
|
||||
once
|
||||
@@ -83,11 +83,13 @@ Web application runs on top of connectors
|
||||
|
||||
Select connectors you want to support:
|
||||
]")
|
||||
Result.add_boolean_question ("Standalone", "use_standalone", "Using the Eiffel Web nino server")
|
||||
Result.add_boolean_question ("Standalone", "use_standalone", "Using the standalone Eiffel Web server")
|
||||
Result.add_boolean_question ("Nino", "use_nino", "Using the Eiffel Web nino server")
|
||||
Result.add_boolean_question ("CGI", "use_cgi", "Require a httpd server")
|
||||
Result.add_boolean_question ("libFCGI", "use_libfcgi", "Require a httpd server")
|
||||
|
||||
Result.data.force ("yes", "use_standalone")
|
||||
Result.data.force ("no", "use_nino")
|
||||
Result.data.force ("yes", "use_cgi")
|
||||
Result.data.force ("yes", "use_libfcgi")
|
||||
end
|
||||
@@ -95,7 +97,7 @@ Select connectors you want to support:
|
||||
standalone_connector_page: WIZARD_PAGE
|
||||
once
|
||||
Result := new_page ("standalone_connector")
|
||||
Result.set_title ("Standalone (nino) connector")
|
||||
Result.set_title ("Standalone (or nino) connector")
|
||||
Result.set_subtitle ("Set options .")
|
||||
Result.add_integer_question ("Port number", "port", "It happens port 80 is already taken, thus choose another one.")
|
||||
Result.add_boolean_question ("Verbose", "verbose", "Verbose output")
|
||||
@@ -117,6 +119,19 @@ Use the router component to easily map URL patterns to handlers:
|
||||
Result.data.force ("yes", "use_router")
|
||||
end
|
||||
|
||||
filters_page: WIZARD_PAGE
|
||||
once
|
||||
Result := new_page ("filters")
|
||||
Result.set_title ("Use Filter (chain filter)")
|
||||
Result.set_subtitle ("Use the filter component.")
|
||||
Result.add_text ("[
|
||||
Use the filter component:
|
||||
]")
|
||||
Result.add_boolean_question ("use the filter component", "use_filter", "Check generated code to see how to configure it.")
|
||||
|
||||
Result.data.force ("yes", "use_filter")
|
||||
end
|
||||
|
||||
final_page: WIZARD_PAGE
|
||||
local
|
||||
-- s,sv: STRING_32
|
||||
@@ -160,6 +175,12 @@ Use the router component to easily map URL patterns to handlers:
|
||||
end
|
||||
sv.append ("standalone")
|
||||
end
|
||||
if connectors_page.boolean_field_value ("use_nino") then
|
||||
if not sv.is_empty then
|
||||
sv.append (", ")
|
||||
end
|
||||
sv.append ("nino")
|
||||
end
|
||||
if connectors_page.boolean_field_value ("use_cgi") then
|
||||
if not sv.is_empty then
|
||||
sv.append (", ")
|
||||
@@ -178,6 +199,9 @@ Use the router component to easily map URL patterns to handlers:
|
||||
if routers_page.boolean_field_value ("use_router") then
|
||||
l_settings.force (["Use Router", "yes"])
|
||||
end
|
||||
if routers_page.boolean_field_value ("use_filter") then
|
||||
l_settings.force (["Use Filter", "yes"])
|
||||
end
|
||||
|
||||
a_txt2.set_text (formatted_title_value_items (l_settings))
|
||||
end(Result, txt1, txt2))
|
||||
@@ -195,7 +219,10 @@ feature -- Events
|
||||
elseif a_current_page = project_page then
|
||||
Result := connectors_page
|
||||
elseif a_current_page = connectors_page then
|
||||
if connectors_page.boolean_field_value ("use_standalone") then
|
||||
if
|
||||
connectors_page.boolean_field_value ("use_standalone")
|
||||
or connectors_page.boolean_field_value ("use_nino")
|
||||
then
|
||||
Result := standalone_connector_page
|
||||
else
|
||||
Result := routers_page
|
||||
@@ -203,6 +230,8 @@ feature -- Events
|
||||
elseif a_current_page = standalone_connector_page then
|
||||
Result := routers_page
|
||||
elseif a_current_page = routers_page then
|
||||
Result := filters_page
|
||||
elseif a_current_page = filters_page then
|
||||
Result := final_page
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user