Reviewed the semantic of the handler context.
Adapted existing code to fit the new router design.
This commit is contained in:
@@ -42,9 +42,9 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Helper: mapping
|
||||
|
||||
map_agent_uri (a_uri: READABLE_STRING_8; a_action: like {WSF_AGENT_URI_HANDLER}.action; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||
map_agent_uri (a_uri: READABLE_STRING_8; a_action: like {WSF_URI_AGENT_HANDLER}.action; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||
do
|
||||
router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, create {WSF_AGENT_URI_HANDLER}.make (a_action)), rqst_methods)
|
||||
router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, create {WSF_URI_AGENT_HANDLER}.make (a_action)), rqst_methods)
|
||||
end
|
||||
|
||||
map_uri_template (a_tpl: READABLE_STRING_8; a_handler: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||
@@ -52,9 +52,9 @@ feature -- Helper: mapping
|
||||
router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, a_handler), rqst_methods)
|
||||
end
|
||||
|
||||
map_agent_uri_template_response (a_tpl: READABLE_STRING_8; a_action: like {WSF_AGENT_URI_TEMPLATE_RESPONSE_HANDLER}.action; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||
map_agent_uri_template_response (a_tpl: READABLE_STRING_8; a_action: like {WSF_URI_TEMPLATE_RESPONSE_AGENT_HANDLER}.action; rqst_methods: detachable WSF_ROUTER_METHODS)
|
||||
do
|
||||
router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, create {WSF_AGENT_URI_TEMPLATE_RESPONSE_HANDLER}.make (a_action)), rqst_methods)
|
||||
router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, create {WSF_URI_TEMPLATE_RESPONSE_AGENT_HANDLER}.make (a_action)), rqst_methods)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
@@ -114,7 +114,7 @@ feature -- Execution
|
||||
res.send (mesg)
|
||||
end
|
||||
|
||||
response_user (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
response_user (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
-- Computed response message.
|
||||
local
|
||||
html: WSF_HTML_PAGE_RESPONSE
|
||||
@@ -122,7 +122,7 @@ feature -- Execution
|
||||
s: STRING_8
|
||||
l_username: STRING_32
|
||||
do
|
||||
if attached {WSF_STRING} ctx.path_parameter ("user") as u then
|
||||
if attached {WSF_STRING} req.path_parameter ("user") as u then
|
||||
l_username := (create {HTML_ENCODER}).general_decoded_string (u.value)
|
||||
if
|
||||
attached {WSF_STRING} req.query_parameter ("op") as l_op
|
||||
|
||||
@@ -13,16 +13,16 @@ inherit
|
||||
|
||||
feature -- Access
|
||||
|
||||
response (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
|
||||
local
|
||||
l_username: READABLE_STRING_32
|
||||
do
|
||||
if attached {WSF_STRING} ctx.path_parameter ("user") as u then
|
||||
if attached {WSF_STRING} req.path_parameter ("user") as u then
|
||||
l_username := html_decoded_string (u.value)
|
||||
if req.is_request_method ("GET") then
|
||||
Result := user_message_get (l_username, ctx, req)
|
||||
Result := user_message_get (l_username, req)
|
||||
elseif req.is_request_method ("POST") then
|
||||
Result := user_message_response_post (l_username, ctx, req)
|
||||
Result := user_message_response_post (l_username, req)
|
||||
else
|
||||
Result := unsupported_method_response (req)
|
||||
end
|
||||
@@ -46,7 +46,7 @@ feature -- Access
|
||||
end
|
||||
|
||||
|
||||
user_message_get (u: READABLE_STRING_32; ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||
user_message_get (u: READABLE_STRING_32; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
@@ -59,7 +59,7 @@ feature -- Access
|
||||
Result.set_body (s)
|
||||
end
|
||||
|
||||
user_message_response_post (u: READABLE_STRING_32; ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||
user_message_response_post (u: READABLE_STRING_32; req: WSF_REQUEST): WSF_HTML_PAGE_RESPONSE
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user