Applied new ROUTER design to the whole EWF project.

This commit is contained in:
Jocelyn Fiat
2012-09-25 23:18:17 +02:00
parent 0503e63209
commit 28186efbe7
61 changed files with 960 additions and 1129 deletions

View File

@@ -8,19 +8,19 @@ note
revision: "$Revision$"
deferred class
WSF_FILTER_HANDLER [C -> WSF_HANDLER_CONTEXT]
WSF_FILTER_HANDLER [H -> WSF_HANDLER]
inherit
WSF_HANDLER [C]
WSF_HANDLER
feature -- Access
next: detachable WSF_FILTER_HANDLER [C]
-- Next filter
next: detachable H
-- Next handler
feature -- Element change
set_next (a_next: WSF_FILTER_HANDLER [C])
set_next (a_next: like next)
-- Set `next' to `a_next'
do
next := a_next
@@ -28,16 +28,6 @@ feature -- Element change
next_set: next = a_next
end
feature {NONE} -- Implementation
execute_next (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the `next' filter.
do
if attached next as n then
n.execute (ctx, req, res)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
WSF_FILTER_URI_HANDLER
inherit
WSF_FILTER_HANDLER [WSF_URI_HANDLER]
WSF_URI_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

View File

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
WSF_FILTER_URI_TEMPLATE_HANDLER
inherit
WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
WSF_URI_TEMPLATE_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

View File

@@ -1,11 +1,11 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_FILTERED_SERVICE}."
description: "Summary description for {WSF_FILTERED_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_FILTERED_SERVICE
WSF_FILTERED_SERVICE
feature {NONE} -- Initialization

View File

@@ -1,75 +0,0 @@
note
description: "Routing filter."
author: "Olivier Ligot"
date: "$Date$"
revision: "$Revision$"
class
WSF_ROUTING_FILTER [H -> WSF_HANDLER [C], C -> WSF_HANDLER_CONTEXT]
inherit
WSF_FILTER
create
make
feature {NONE} -- Initialization
make (a_router: WSF_ROUTER [H, C])
do
router := a_router
ensure
router_set: router = a_router
end
feature -- Access
router: WSF_ROUTER [H, C]
-- Router
execute_default_action: detachable PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]
-- `execute_default' action
feature -- Element change
set_execute_default_action (an_action: like execute_default_action)
-- Set `execute_default_action' to `an_action'
do
execute_default_action := an_action
ensure
execute_default_action_set: execute_default_action = an_action
end
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
do
if attached router.route (req) as r then
router.execute_route (r, req, res)
else
execute_default (req, res)
end
execute_next (req, res)
end
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached execute_default_action as action then
action.call ([req, res])
else
do_nothing
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

View File

@@ -0,0 +1,59 @@
note
description: "Summary description for {WSF_REQUEST_PATH_PARAMETERS_PROVIDER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_REQUEST_PATH_PARAMETERS_PROVIDER
inherit
WSF_REQUEST_PATH_PARAMETERS_SOURCE
create
make
feature {NONE} -- Initialization
make (nb: INTEGER; a_urlencoded_path_parameters: like urlencoded_path_parameters)
do
path_parameters_count := nb
urlencoded_path_parameters := a_urlencoded_path_parameters
end
feature -- Access
path_parameters_count: INTEGER
urlencoded_path_parameters: TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_8]
-- Raw urlencoded path parameters.
feature -- Operation
previous_path_parameters_source: detachable WSF_REQUEST_PATH_PARAMETERS_SOURCE
apply (req: WSF_REQUEST)
-- <Precursor>
do
previous_path_parameters_source := req.path_parameters_source
req.set_path_parameters_source (Current)
end
revert (req: WSF_REQUEST)
-- <Precursor>
do
req.set_path_parameters_source (previous_path_parameters_source)
previous_path_parameters_source := Void
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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