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

@@ -58,6 +58,8 @@ feature -- Mapping
deferred
end
feature -- Mapping agent
map_agent (a_resource: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE]])
do
map_agent_with_request_methods (a_resource, a_action, Void)
@@ -76,6 +78,26 @@ feature -- Mapping
end
end
feature -- Mapping response agent
map_agent_response (a_resource: READABLE_STRING_8; a_action: FUNCTION [ANY, TUPLE [ctx: C; req: WSF_REQUEST], WSF_RESPONSE_MESSAGE])
do
map_agent_response_with_request_methods (a_resource, a_action, Void)
end
map_agent_response_with_request_methods (a_resource: READABLE_STRING_8; a_action: FUNCTION [ANY, TUPLE [ctx: C; req: WSF_REQUEST], WSF_RESPONSE_MESSAGE];
rqst_methods: detachable ARRAY [READABLE_STRING_8])
local
rah: WSF_AGENT_RESPONSE_HANDLER [C]
do
create rah.make (a_action)
if attached {H} rah as h then
map_with_request_methods (a_resource, h, rqst_methods)
else
check valid_agent_handler: False end
end
end
feature -- Base url
base_url: detachable READABLE_STRING_8