forked from EiffelWebFramework/EWF
-
Notifications
You must be signed in to change notification settings - Fork 2
/
wsf_routed_execution.e
96 lines (80 loc) · 1.88 KB
/
wsf_routed_execution.e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
note
description: "Execution based on router."
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_ROUTED_EXECUTION
inherit
WSF_EXECUTION
redefine
initialize
end
WSF_ROUTED
feature {NONE} -- Initialize
initialize
do
Precursor
initialize_router
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)
end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end