Added routing condition mapping.

Added WSF_EXECUTE_HANDLER as common ancestor for handler with `execute (WSF_REQUEST, WSF_RESPONSE) ..` routine.
Made more flexible a few routine by accepting ITERABLE instead of ARRAY, and READABLE_STRING_GENERAL when possible.
This commit is contained in:
Jocelyn Fiat
2017-11-03 17:59:10 +01:00
parent f770c236d5
commit 95cebe26bb
32 changed files with 822 additions and 186 deletions

View File

@@ -0,0 +1,45 @@
note
description: "Summary description for {WSF_EXECUTE_AGENT_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
WSF_EXECUTE_AGENT_HANDLER
inherit
WSF_HANDLER
WSF_EXECUTE_HANDLER
create
make
feature {NONE} -- Initialization
make (a_action: like action)
do
action := a_action
end
feature -- Access
action: PROCEDURE [TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do
action (req, res)
end
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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_EXECUTE_FILTER_HANDLER
inherit
WSF_FILTER_HANDLER [WSF_EXECUTE_HANDLER]
WSF_EXECUTE_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-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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,44 @@
note
description: "Summary description for {WSF_EXECUTE_RESPONSE_AGENT_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_EXECUTE_RESPONSE_AGENT_HANDLER
inherit
WSF_EXECUTE_RESPONSE_HANDLER
create
make
feature -- Initialization
make (act: like action)
do
action := act
end
feature -- Access
action: FUNCTION [TUPLE [req: WSF_REQUEST], WSF_RESPONSE_MESSAGE]
feature -- Execution
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
do
Result := action.item ([req])
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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,40 @@
note
description: "Summary description for {WSF_EXECUTE_RESPONSE_HANDLER}."
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_EXECUTE_RESPONSE_HANDLER
inherit
WSF_EXECUTE_HANDLER
feature -- Response
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
require
is_valid_context: is_valid_context (req)
deferred
ensure
Result_attached: Result /= Void
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
res.send (response (req))
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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,28 @@
note
description: "Summary description for {WSF_EXECUTE_ROUTING_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
WSF_EXECUTE_ROUTING_HANDLER
inherit
WSF_ROUTING_HANDLER
WSF_EXECUTE_HANDLER
create
make
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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,61 @@
note
description: "Summary description for {WSF_SELF_DOCUMENTED_EXECUTE_AGENT_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
WSF_SELF_DOCUMENTED_EXECUTE_AGENT_HANDLER
inherit
WSF_EXECUTE_AGENT_HANDLER
rename
make as make_handler
end
WSF_SELF_DOCUMENTED_AGENT_HANDLER
create
make,
make_with_descriptions,
make_hidden
feature {NONE} -- Initialization
make (a_action: like action; a_self_doc: like self_documentation_builder)
-- <Precursor>
-- and using `a_self_doc' function to build the `mapping_documentation'.
do
set_self_documentation_builder (a_self_doc)
make_handler (a_action)
end
make_with_descriptions (a_action: like action; a_descriptions: ITERABLE [READABLE_STRING_GENERAL])
do
across
a_descriptions as c
loop
add_description (c.item)
end
make_handler (a_action)
end
make_hidden (a_action: like action)
-- <Precursor>
-- and using `a_self_doc' function to build the `mapping_documentation'
-- mark it as `hidden'.
do
is_hidden := True
make (a_action, Void)
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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: "[
Represents the ancestor of all the WSF_ROUTER handlers with `execute (WSF_REQUEST, WSF_RESPONSE)` routine.
]"
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_EXECUTE_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute `req' responding in `res'.
require
req_attached: req /= Void
res_attached: res /= Void
deferred
end
note
copyright: "2011-2017, 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