Experimentation of WSF_EXECUTOR.execute (req, res)

This commit is contained in:
2015-06-18 14:49:29 +02:00
parent 903f925a79
commit 91fbb3866f
7 changed files with 467 additions and 63 deletions

View File

@@ -12,75 +12,27 @@ inherit
initialize
end
WSF_ROUTED
WSF_ROUTED_EXECUTOR
rename
initialize as initialize_executor,
execute as process_execution
end
feature {NONE} -- Initialize
initialize
do
Precursor
initialize_router
Precursor {WSF_EXECUTION}
initialize_executor
end
feature -- Router
initialize_router
-- Initialize router
do
create_router
setup_router
end
create_router
-- Create `router'
--| could be redefine to initialize with proper capacity
do
create router.make (10)
ensure
router_created: router /= Void
end
setup_router
-- Setup `router'
require
router_created: router /= Void
deferred
end
feature -- Access
router: WSF_ROUTER
-- Router used to dispatch the request according to the WSF_REQUEST object
-- and associated request methods
feature -- Execution
execute
-- Dispatch the request
-- and if handler is not found, execute the default procedure `execute_default'.
do
router_execute (request, response)
end
router_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
local
sess: WSF_ROUTER_SESSION
do
create sess
router.dispatch (req, res, sess)
if not sess.dispatched then
execute_default (req, res)
end
end
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Dispatch requests without a matching handler.
local
msg: WSF_DEFAULT_ROUTER_RESPONSE
do
create msg.make_with_router (request, router)
msg.set_documentation_included (True)
response.send (msg)
process_execution (request, response)
end
note