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

@@ -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