From 945ef7985771f7d68789a9a290f02453dfd9420b Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 31 Jan 2012 12:12:41 +0100 Subject: [PATCH] added REQUEST_HANDLER_CONTEXT.string_array_path_parameter (...) to help user handling list/array parameters fixed postcondition WSF_REQUEST.set_meta_string_variable ... --- .../wsf/router/request_handler_context.e | 23 +++++++++++++++++++ .../request_uri_template_handler_context.e | 2 +- library/server/wsf/src/wsf_request.e | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/library/server/wsf/router/request_handler_context.e b/library/server/wsf/router/request_handler_context.e index 2863b78c..a12ae212 100644 --- a/library/server/wsf/router/request_handler_context.e +++ b/library/server/wsf/router/request_handler_context.e @@ -141,6 +141,29 @@ feature -- String query Result := string_from (path_parameter (a_name)) end + string_array_path_parameter (a_name: READABLE_STRING_8): detachable ARRAY [READABLE_STRING_32] + local + i: INTEGER + n: INTEGER + do + from + i := 1 + n := 1 + create Result.make_filled ("", 1, 5) + until + i = 0 + loop + if attached string_path_parameter (a_name + "[" + i.out + "]") as v then + Result.force (v, n) + n := n + 1 + i := i + 1 + else + i := 0 -- Exit + end + end + Result.keep_head (n) + end + string_query_parameter (a_name: READABLE_STRING_8): detachable READABLE_STRING_32 do Result := string_from (query_parameter (a_name)) diff --git a/library/server/wsf/router/uri_template/request_uri_template_handler_context.e b/library/server/wsf/router/uri_template/request_uri_template_handler_context.e index 0f9ded4c..835b1a85 100644 --- a/library/server/wsf/router/uri_template/request_uri_template_handler_context.e +++ b/library/server/wsf/router/uri_template/request_uri_template_handler_context.e @@ -29,7 +29,7 @@ feature -- Access uri_template_match: URI_TEMPLATE_MATCH_RESULT -feature -- Query +feature -- Query path_parameter (a_name: READABLE_STRING_8): detachable WSF_VALUE do diff --git a/library/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e index 873c2575..be473168 100644 --- a/library/server/wsf/src/wsf_request.e +++ b/library/server/wsf/src/wsf_request.e @@ -298,7 +298,7 @@ feature -- Access: CGI Meta variables do meta_variables_table.force (new_string_value (a_name, a_value), a_name) ensure - param_set: attached {WSF_STRING} meta_variable (a_name) as val and then val ~ a_value + param_set: attached {WSF_STRING} meta_variable (a_name) as val and then val.url_encoded_string.same_string (a_value) end unset_meta_variable (a_name: READABLE_STRING_8)