diff --git a/library/server/wsf/router/uri/default/wsf_uri_router.e b/library/server/wsf/router/uri/default/wsf_uri_router.e index e697561d..5b7c78ca 100644 --- a/library/server/wsf/router/uri/default/wsf_uri_router.e +++ b/library/server/wsf/router/uri/default/wsf_uri_router.e @@ -13,6 +13,7 @@ inherit redefine map_agent_with_request_methods, map_agent_response_with_request_methods end + create make diff --git a/library/server/wsf/router/uri/wsf_uri_router_i.e b/library/server/wsf/router/uri/wsf_uri_router_i.e index f9290bc6..25bf6165 100644 --- a/library/server/wsf/router/uri/wsf_uri_router_i.e +++ b/library/server/wsf/router/uri/wsf_uri_router_i.e @@ -34,6 +34,7 @@ feature -- Initialization do create handlers.make (n) handlers.compare_objects + initialize end make_with_base_url (n: INTEGER; a_base_url: like base_url) diff --git a/library/server/wsf/router/uri_template/wsf_uri_template_router_i.e b/library/server/wsf/router/uri_template/wsf_uri_template_router_i.e index 7c3ce35a..fd4b8b06 100644 --- a/library/server/wsf/router/uri_template/wsf_uri_template_router_i.e +++ b/library/server/wsf/router/uri_template/wsf_uri_template_router_i.e @@ -31,6 +31,7 @@ feature -- Initialization create handlers.make (n) create templates.make (n) handlers.compare_objects + initialize end make_with_base_url (n: INTEGER; a_base_url: like base_url) diff --git a/library/server/wsf/router/wsf_routed_service_i.e b/library/server/wsf/router/wsf_routed_service_i.e index 7170cd04..fa82da2a 100644 --- a/library/server/wsf/router/wsf_routed_service_i.e +++ b/library/server/wsf/router/wsf_routed_service_i.e @@ -36,11 +36,10 @@ feature -- Setup feature -- Execution execute (req: WSF_REQUEST; res: WSF_RESPONSE) - local - l_handled: BOOLEAN do - l_handled := router.dispatch (req, res) - if not l_handled then + if attached router.route (req) as r then + router.execute_route (r, req, res) + else execute_default (req, res) end end diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e index b6a7226e..49eebc9b 100644 --- a/library/server/wsf/router/wsf_router.e +++ b/library/server/wsf/router/wsf_router.e @@ -12,6 +12,14 @@ deferred class inherit ITERABLE [TUPLE [handler: H; resource: READABLE_STRING_8; request_methods: detachable ARRAY [READABLE_STRING_8]]] +feature {NONE} -- Initialization + + initialize + -- Initialize router + do + create pre_route_execution_actions + end + feature -- Status report has_map (a_resource: READABLE_STRING_8; rqst_methods: detachable ARRAY [READABLE_STRING_8]; a_handler: detachable H): BOOLEAN @@ -116,7 +124,13 @@ feature -- Element change end end -feature -- Execution +feature -- Hook + + pre_route_execution_actions: ACTION_SEQUENCE [TUPLE [like route]] + -- Action triggered before a route is execute + --| Could be used for tracing, logging + +feature -- Routing route (req: WSF_REQUEST): detachable WSF_ROUTE [H, C] -- Route matching `req'. @@ -124,11 +138,14 @@ feature -- Execution Result := matching_route (req) end +feature -- Execution + execute_route (a_route: WSF_ROUTE [H,C]; req: WSF_REQUEST; res: WSF_RESPONSE) -- Process route `a_route' require a_route_attached: a_route /= Void do + pre_route_execution_actions.call ([a_route]) a_route.handler.execute (a_route.context, req, res) end diff --git a/library/server/wsf/router/wsf_routing_handler.e b/library/server/wsf/router/wsf_routing_handler.e index a33ca438..3d37fa20 100644 --- a/library/server/wsf/router/wsf_routing_handler.e +++ b/library/server/wsf/router/wsf_routing_handler.e @@ -24,8 +24,7 @@ note revision: "$Revision$" deferred class - WSF_ROUTING_HANDLER [H -> WSF_HANDLER [C], - C -> WSF_HANDLER_CONTEXT] + WSF_ROUTING_HANDLER [H -> WSF_HANDLER [C], C -> WSF_HANDLER_CONTEXT] inherit WSF_HANDLER [C]