Fixed the EiffelStudio EiffelWeb wizard.

This commit is contained in:
2016-10-21 19:40:13 +02:00
parent 53f4f64596
commit 2e49febca8
4 changed files with 45 additions and 37 deletions

View File

@@ -15,10 +15,10 @@
</target>
<target name="{$WIZ.project.name/}_any" extends="common">
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
{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_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="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>{/if}
<cluster name="launcher" location=".\launcher\" recursive="true">
<cluster name="launcher" location=".\launcher\">
<cluster name="any_launcher" location="$|any"/>
</cluster>
<cluster name="src" location=".\src\" recursive="true"/>

View File

@@ -20,28 +20,27 @@ feature -- Execution
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
-- Launch Web Server Application using optionals `opts'.
local
launcher: WSF_SERVICE_LAUNCHER
launcher: WSF_SERVICE_LAUNCHER [G]
do
l_id := launcher_id
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_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
elseif is_standalone_launcher_id (l_id) then
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} 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}
create {WSF_LIBFCGI_SERVICE_LAUNCHER [G]} 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}
create {WSF_CGI_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}{literal}
elseif is_standalone_launcher_id (l_id) then
create {WSF_STANDALONE_SERVICE_LAUNCHER} launcher.make_and_launch (opts){/literal}{/if}
create {WSF_STANDALONE_SERVICE_LAUNCHER [G]} launcher.make_and_launch (opts){/literal}{/if}
{literal}
else
io.error.put_string ("Application launcher not found!%N")
@@ -53,31 +52,39 @@ feature -- Execution
-- Launcher id based on the executable extension name if any.
-- This can be redefine to customize for your application.
--| ex: standalone, cgi, libfcgi or Void.
local
p: PATH
s: READABLE_STRING_32
do
if attached (create {PATH}.make_from_string (execution_environment.arguments.command_name)).extension as ext then
Result := ext
create p.make_from_string (execution_environment.arguments.command_name)
if attached p.extension as ext then
if ext.is_case_insensitive_equal_general ("exe") then
-- Windows
s := p.name
create p.make_from_string (s.head (s.count - 4))
Result := p.extension
else
Result := ext
end
end
end
feature -- Status report
{/literal}
feature -- Status report{/literal}
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}
is_standalone_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("standalone")
Result := a_id.is_case_insensitive_equal ("standalone")
end{/if}
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}
is_cgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("cgi")
Result := a_id.is_case_insensitive_equal ("cgi")
end{/if}
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}
is_libfcgi_launcher_id (a_id: READABLE_STRING_GENERAL): BOOLEAN
do
Result := a_id.is_case_insensitive ("libfcgi")
or a_id.is_case_insensitive ("fcgi")
Result := a_id.is_case_insensitive_equal ("libfcgi")
or a_id.is_case_insensitive_equal ("fcgi")
end{/if}
end

View File

@@ -14,10 +14,8 @@ inherit
redefine
initialize
end
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}
WSF_ROUTED_SERVICE{/if}
{if isset="$APP_ROOT"}APPLICATION_LAUNCHER [{$APP_ROOT/}_EXECUTION]{/if}
{unless isset="$APP_ROOT"}APPLICATION_LAUNCHER [APPLICATION_EXECUTION]{/if}
{unless isset="$APP_ROOT"}APPLICATION_LAUNCHER [APPLICATION_EXECUTION]{/unless}
{literal}create
make_and_launch
@@ -29,6 +27,7 @@ feature {NONE} -- Initialization
do
Precursor
set_service_option ("port", {$WIZ.standalone_connector.port/})
set_service_option ("verbose", "{$WIZ.standalone_connector.verbose/}")
end

View File

@@ -11,15 +11,15 @@ class
inherit
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}
{unless condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
{unless condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
WSF_EXECUTION{/unless}
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
{if condition="$WIZ.filters.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"}
{unless condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
WSF_ROUTED_EXECUTION{/unless}
{if condition="$WIZ.routers.use_filter ~ $WIZ_YES"}
{if condition="$WIZ.filters.use_filter ~ $WIZ_YES"}
WSF_FILTERED_ROUTED_EXECUTION{/if}
{/if}
@@ -28,7 +28,6 @@ inherit
feature {NONE} -- Initialization
{/literal}
{unless condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
feature -- Execution
@@ -42,9 +41,9 @@ feature -- Execution
--| 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}
end
{/literal}{/unless}
{if condition="$WIZ.filters.use_filter ~ $WIZ_YES"}{literal}
feature -- Filter
create_filter
@@ -56,15 +55,18 @@ feature -- Filter
setup_filter
-- Setup `filter'
local
f: like filter
do
append_filters (<<
create {WSF_CORS_FILTER},
create {WSF_LOGGING_FILTER}
>>)
create {WSF_CORS_FILTER} f
f.set_next (create {WSF_LOGGING_FILTER})
--| Chain more filters like {WSF_CUSTOM_HEADER_FILTER}, ...
--| and your owns filters.
end{/if}
filter.append (f)
end
{/literal}{/if}
{if condition="$WIZ.routers.use_router ~ $WIZ_YES"}{literal}
feature -- Router
@@ -78,12 +80,12 @@ feature -- Router
--| /* 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)
router.handle ("/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)
router.handle ("", fhdl, router.methods_GET)
end{/literal}{/if}
end