diff --git a/draft/library/server/request/rest/src/rest_request_agent_handler.e b/draft/library/server/request/rest/src/rest_request_agent_handler.e index f84ddc63..eb0c3ffb 100644 --- a/draft/library/server/request/rest/src/rest_request_agent_handler.e +++ b/draft/library/server/request/rest/src/rest_request_agent_handler.e @@ -2,7 +2,7 @@ class REST_REQUEST_AGENT_HANDLER inherit - WSF_AGENT_URI_TEMPLATE_HANDLER + WSF_URI_TEMPLATE_AGENT_HANDLER create make diff --git a/draft/library/server/request/rest/src/rest_request_handler.e b/draft/library/server/request/rest/src/rest_request_handler.e index ed33bf59..c61a980d 100644 --- a/draft/library/server/request/rest/src/rest_request_handler.e +++ b/draft/library/server/request/rest/src/rest_request_handler.e @@ -8,7 +8,7 @@ deferred class REST_REQUEST_HANDLER inherit - WSF_URI_TEMPLATE_HANDLER + WSF_URI_TEMPLATE_CONTEXT_HANDLER [WSF_HANDLER_CONTEXT] WSF_HANDLER_HELPER diff --git a/draft/library/server/request/rest/src/rest_request_handler_context.e b/draft/library/server/request/rest/src/rest_request_handler_context.e index a90e7d20..b928b4d8 100644 --- a/draft/library/server/request/rest/src/rest_request_handler_context.e +++ b/draft/library/server/request/rest/src/rest_request_handler_context.e @@ -10,6 +10,8 @@ deferred class inherit WSF_HANDLER_CONTEXT + WSF_REQUEST_UTILITY + feature -- Accept: Content-Type accepted_content_type: detachable READABLE_STRING_8 @@ -23,7 +25,7 @@ feature -- Accept: Content-Type get_accepted_content_type (a_supported_content_types: detachable ARRAY [STRING_8]) do if internal_accepted_content_type = Void then - internal_accepted_content_type := request_accepted_content_type (a_supported_content_types) + internal_accepted_content_type := request_accepted_content_type (request, a_supported_content_types) end end @@ -73,10 +75,10 @@ feature -- Format request_accepted_format (a_format_variable_name: detachable READABLE_STRING_8; a_supported_content_types: detachable ARRAY [READABLE_STRING_8]): detachable READABLE_STRING_8 -- Format id for the request based on {HTTP_FORMAT_CONSTANTS} do - if a_format_variable_name /= Void and then attached string_item (a_format_variable_name) as ctx_format then - Result := ctx_format.as_string_8 + if a_format_variable_name /= Void and then attached {WSF_STRING} request.item (a_format_variable_name) as ctx_format then + Result := ctx_format.value else - Result := request_format_from_content_type (request_accepted_content_type (a_supported_content_types)) + Result := request_format_from_content_type (request_accepted_content_type (request, a_supported_content_types)) end end diff --git a/draft/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e b/draft/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e index 74fcc03f..d44f0eae 100644 --- a/draft/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e +++ b/draft/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e @@ -8,7 +8,7 @@ class REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT inherit - WSF_URI_TEMPLATE_HANDLER_CONTEXT + WSF_HANDLER_CONTEXT REST_REQUEST_HANDLER_CONTEXT diff --git a/examples/filter/src/filter_server.e b/examples/filter/src/filter_server.e index c407cfc6..17c345cc 100644 --- a/examples/filter/src/filter_server.e +++ b/examples/filter/src/filter_server.e @@ -38,7 +38,6 @@ feature {NONE} -- Initialization l_authentication_filter_hdl: AUTHENTICATION_FILTER l_user_filter: USER_HANDLER l_user_handler: WSF_URI_TEMPLATE_HANDLER --- l_routing_hdl: WSF_URI_TEMPLATE_ROUTING_HANDLER --[WSF_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT], WSF_URI_TEMPLATE_HANDLER_CONTEXT] l_routing_filter: WSF_ROUTING_FILTER do create l_router.make (1) diff --git a/examples/tutorial/step_4/hello/src/hello_application.e b/examples/tutorial/step_4/hello/src/hello_application.e index 38d09ced..b2c4d250 100644 --- a/examples/tutorial/step_4/hello/src/hello_application.e +++ b/examples/tutorial/step_4/hello/src/hello_application.e @@ -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 diff --git a/examples/tutorial/step_4/hello/src/user_message_handler.e b/examples/tutorial/step_4/hello/src/user_message_handler.e index cbc95f17..12a6a0e8 100644 --- a/examples/tutorial/step_4/hello/src/user_message_handler.e +++ b/examples/tutorial/step_4/hello/src/user_message_handler.e @@ -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 diff --git a/examples/upload_image/src/image_uploader.e b/examples/upload_image/src/image_uploader.e index 876870e7..e60602d8 100644 --- a/examples/upload_image/src/image_uploader.e +++ b/examples/upload_image/src/image_uploader.e @@ -91,7 +91,7 @@ feature -- Execution res.redirect_now_with_content (req.script_url ("/"), uri + ": not found.%NRedirection to " + req.script_url ("/"), "text/html") end - execute_upload (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) + execute_upload (req: WSF_REQUEST; res: WSF_RESPONSE) -- Upload page is requested, either GET or POST -- On GET display the web form to upload file, by passing ?nb=5 you can upload 5 images -- On POST display the uploaded files @@ -110,14 +110,14 @@ feature -- Execution page.set_body (l_body) l_body.append ("