Added WSF_RESPONSE_HANDLER based on WSF_RESPONSE_MESSAGE

The descendant has to implement the function

    response (ctx: C; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE

Added related features and class in WSF_ROUTER to be able to use agent easily.
This commit is contained in:
Jocelyn Fiat
2012-03-19 12:04:46 +01:00
parent ef5ba19c46
commit 487487ad44
5 changed files with 136 additions and 4 deletions

View File

@@ -10,12 +10,12 @@ class
inherit
WSF_URI_ROUTER_I [WSF_HANDLER [WSF_URI_HANDLER_CONTEXT], WSF_URI_HANDLER_CONTEXT]
redefine
map_agent_with_request_methods
map_agent_with_request_methods, map_agent_response_with_request_methods
end
create
make
feature -- Mapping
feature -- Mapping agent
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: WSF_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
@@ -26,6 +26,15 @@ feature -- Mapping
map_with_request_methods (a_id, h, rqst_methods)
end
map_agent_response_with_request_methods (a_id: READABLE_STRING_8; a_action: FUNCTION [ANY, TUPLE [ctx: WSF_URI_HANDLER_CONTEXT; req: WSF_REQUEST], WSF_RESPONSE_MESSAGE];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
h: WSF_AGENT_RESPONSE_HANDLER [WSF_URI_HANDLER_CONTEXT]
do
create h.make (a_action)
map_with_request_methods (a_id, h, rqst_methods)
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)"