diff --git a/examples/hello_routed_world/src/hello_routed_world.e b/examples/hello_routed_world/src/hello_routed_world.e index c34f3bcd..ec73bb93 100644 --- a/examples/hello_routed_world/src/hello_routed_world.e +++ b/examples/hello_routed_world/src/hello_routed_world.e @@ -10,7 +10,7 @@ class inherit ANY - DEFAULT_URI_TEMPLATE_ROUTED_APPLICATION + URI_TEMPLATE_ROUTED_APPLICATION ROUTED_APPLICATION_HELPER @@ -35,7 +35,7 @@ feature {NONE} -- Initialization setup_router local ra: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] - rag: DEFAULT_REQUEST_URI_TEMPLATE_ROUTING_HANDLER + rag: REQUEST_URI_TEMPLATE_ROUTING_HANDLER do router.map_agent ("/home", agent execute_home) @@ -125,8 +125,8 @@ feature -- Execution res.write_string ("
  • /hello/Joce
  • %N") res.write_string ("%N") - if attached req.parameter ("REQUEST_COUNT") as rqc then - res.write_string ("request #"+ rqc + "%N") + if attached req.item ("REQUEST_COUNT") as rqc then + res.write_string ("request #"+ rqc.as_string + "%N") end res.write_string ("%N") end @@ -182,7 +182,7 @@ feature -- Execution handle_anonymous_hello (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) do - execute_hello (req, res, ctx.parameter ("name"), ctx) + execute_hello (req, res, ctx.string_parameter ("name"), ctx) end handle_method_any (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) diff --git a/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e b/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e new file mode 100644 index 00000000..9654cbb5 --- /dev/null +++ b/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e @@ -0,0 +1,122 @@ +note + description: "Summary description for {WGI_MULTIPLE_STRING_VALUE}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WGI_MULTIPLE_STRING_VALUE + +inherit + WGI_VALUE + + ITERABLE [WGI_STRING_VALUE] + +create + make_with_value, + make_with_string + +feature {NONE} -- Initialization + + make_with_value (a_value: WGI_VALUE) + do + name := a_value.name + create {LINKED_LIST [WGI_STRING_VALUE]} string_values.make + add_value (a_value) + end + + make_with_string (a_name: like name; a_string: READABLE_STRING_32) + do + make_with_value (create {WGI_STRING_VALUE}.make (a_name, a_string)) + end + +feature -- Access + + name: READABLE_STRING_GENERAL + + string_values: LIST [WGI_STRING_VALUE] + + first_string_value: WGI_STRING_VALUE + do + Result := string_values.first + end + +feature -- Traversing + + new_cursor: ITERATION_CURSOR [WGI_STRING_VALUE] + do + Result := string_values.new_cursor + end + +feature -- Helper + + same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN + -- Does `a_other' represent the same string as `Current'? + do + if string_values.count = 1 then + Result := first_string_value.same_string (a_other) + end + end + + is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN + -- Does `a_other' represent the same case insensitive string as `Current'? + do + if string_values.count = 1 then + Result := first_string_value.is_case_insensitive_equal (a_other) + end + end + + as_string: STRING_32 + do + if string_values.count = 1 then + create Result.make_from_string (first_string_value) + else + create Result.make_from_string ("[") + across + string_values as c + loop + if Result.count = 1 then + Result.append_character (',') + end + Result.append_string (c.item) + end + Result.append_character (']') + end + end + +feature -- Element change + + add_value (a_value: WGI_VALUE) + require + same_name: a_value.name.same_string (name) + do + if attached {WGI_STRING_VALUE} a_value as sval then + add_string_value (sval) + elseif attached {WGI_MULTIPLE_STRING_VALUE} a_value as slst then + across + slst as cur + loop + add_string_value (cur.item) + end + end + end + + add_string_value (s: WGI_STRING_VALUE) + do + string_values.extend (s) + end + +invariant + string_values_not_empty: string_values.count >= 1 + +;note + copyright: "2011-2011, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end diff --git a/library/server/ewsgi/specification/request/value/wgi_string_value.e b/library/server/ewsgi/specification/request/value/wgi_string_value.e index c39664bc..765e321e 100644 --- a/library/server/ewsgi/specification/request/value/wgi_string_value.e +++ b/library/server/ewsgi/specification/request/value/wgi_string_value.e @@ -18,32 +18,32 @@ convert feature {NONE} -- Initialization - make (a_name: like name; a_value: like value) + make (a_name: like name; a_string: like string) do name := a_name - value := a_value + string := a_string end feature -- Access name: READABLE_STRING_GENERAL - value: READABLE_STRING_32 + string: READABLE_STRING_32 feature -- Helper same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN -- Does `a_other' represent the same string as `Current'? do - Result := value.same_string_general (a_other) + Result := string.same_string_general (a_other) end is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN -- Does `a_other' represent the same case insensitive string as `Current'? local - v: like value + v: like string do - v := value + v := string if v = a_other then Result := True elseif v.is_valid_as_string_8 then @@ -55,7 +55,7 @@ feature -- Conversion as_string: STRING_32 do - create Result.make_from_string (value) + create Result.make_from_string (string) end ;note diff --git a/library/server/ewsgi/src/request/wgi_request_from_table.e b/library/server/ewsgi/src/request/wgi_request_from_table.e index c24678f2..3a819e2a 100644 --- a/library/server/ewsgi/src/request/wgi_request_from_table.e +++ b/library/server/ewsgi/src/request/wgi_request_from_table.e @@ -161,9 +161,9 @@ feature -- Access extra information do if attached {WGI_STRING_VALUE} meta_variable ({WGI_META_NAMES}.request_time) as t and then - t.value.is_integer_64 + t.string.is_integer_64 then - Result := date_time_utilities.unix_time_stamp_to_date_time (t.value.to_integer_64) + Result := date_time_utilities.unix_time_stamp_to_date_time (t.string.to_integer_64) end end @@ -567,7 +567,7 @@ feature {NONE} -- Cookies l_cookies := internal_cookies_table if l_cookies = Void then if attached {WGI_STRING_VALUE} meta_variable ({WGI_META_NAMES}.http_cookie) as val then - s := val.value + s := val.string create l_cookies.make (5) from n := s.count @@ -698,7 +698,7 @@ feature -- Access: global variable string_item (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32 do if attached {WGI_STRING_VALUE} item (a_name) as val then - Result := val.value + Result := val.string else check is_string_value: False end end diff --git a/library/server/request/rest/src/contrib/doc/rest_api_documentation.e b/library/server/request/rest/src/contrib/doc/rest_api_documentation.e index 939e0c27..f20482a8 100644 --- a/library/server/request/rest/src/contrib/doc/rest_api_documentation.e +++ b/library/server/request/rest/src/contrib/doc/rest_api_documentation.e @@ -51,7 +51,7 @@ feature -- Execution if attached {WGI_STRING_VALUE} ctx.path_parameter ("resource") as l_resource_value and then - attached l_resource_value.value as l_resource + attached l_resource_value.string as l_resource then from hdl_cursor := router.new_cursor diff --git a/library/server/request/rest/src/uri/rest_request_uri_handler_context.e b/library/server/request/rest/src/uri/rest_request_uri_handler_context.e index 69224ecd..52566f06 100644 --- a/library/server/request/rest/src/uri/rest_request_uri_handler_context.e +++ b/library/server/request/rest/src/uri/rest_request_uri_handler_context.e @@ -8,7 +8,7 @@ class REST_REQUEST_URI_HANDLER_CONTEXT inherit - REQUEST_URI_HANDLER_CONTEXT_I + REQUEST_URI_HANDLER_CONTEXT REST_REQUEST_HANDLER_CONTEXT diff --git a/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e b/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e index cbc36a31..fd1c829f 100644 --- a/library/server/request/rest/src/uri_template/rest_request_uri_template_handler_context.e +++ b/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 - REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I + REQUEST_URI_TEMPLATE_HANDLER_CONTEXT REST_REQUEST_HANDLER_CONTEXT diff --git a/library/server/request/router/src/request_handler_context.e b/library/server/request/router/src/request_handler_context.e index aaa652ca..1e4f0f4f 100644 --- a/library/server/request/router/src/request_handler_context.e +++ b/library/server/request/router/src/request_handler_context.e @@ -133,7 +133,7 @@ feature -- String query string_from (a_value: detachable WGI_VALUE): detachable READABLE_STRING_32 do if attached {WGI_STRING_VALUE} a_value as val then - Result := val.value + Result := val.string end end diff --git a/library/server/request/router/src/default/request_uri_router.e b/library/server/request/router/src/uri/default/request_uri_router.e similarity index 80% rename from library/server/request/router/src/default/request_uri_router.e rename to library/server/request/router/src/uri/default/request_uri_router.e index 60a45988..99c4d588 100644 --- a/library/server/request/router/src/default/request_uri_router.e +++ b/library/server/request/router/src/uri/default/request_uri_router.e @@ -8,7 +8,7 @@ class REQUEST_URI_ROUTER inherit - REQUEST_URI_ROUTER_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT_I], REQUEST_URI_HANDLER_CONTEXT_I] + REQUEST_URI_ROUTER_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT], REQUEST_URI_HANDLER_CONTEXT] redefine map_agent_with_request_methods end @@ -17,10 +17,10 @@ create feature -- Mapping - map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_HANDLER_CONTEXT_I; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]; + map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]; rqst_methods: detachable ARRAY [READABLE_STRING_8]) local - h: REQUEST_AGENT_HANDLER [REQUEST_URI_HANDLER_CONTEXT_I] + h: REQUEST_AGENT_HANDLER [REQUEST_URI_HANDLER_CONTEXT] do create h.make (a_action) map_with_request_methods (a_id, h, rqst_methods) diff --git a/library/server/request/router/src/default/request_uri_routing_handler.e b/library/server/request/router/src/uri/default/request_uri_routing_handler.e similarity index 93% rename from library/server/request/router/src/default/request_uri_routing_handler.e rename to library/server/request/router/src/uri/default/request_uri_routing_handler.e index 83b6358f..7492a92d 100644 --- a/library/server/request/router/src/default/request_uri_routing_handler.e +++ b/library/server/request/router/src/uri/default/request_uri_routing_handler.e @@ -8,7 +8,7 @@ class REQUEST_URI_ROUTING_HANDLER inherit - REQUEST_URI_ROUTING_HANDLER_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT_I], REQUEST_URI_HANDLER_CONTEXT_I] + REQUEST_URI_ROUTING_HANDLER_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT], REQUEST_URI_HANDLER_CONTEXT] redefine router end diff --git a/library/server/request/router/src/default/uri_routed_application.e b/library/server/request/router/src/uri/default/uri_routed_application.e similarity index 94% rename from library/server/request/router/src/default/uri_routed_application.e rename to library/server/request/router/src/uri/default/uri_routed_application.e index 038266bc..ff3272f0 100644 --- a/library/server/request/router/src/default/uri_routed_application.e +++ b/library/server/request/router/src/uri/default/uri_routed_application.e @@ -8,7 +8,7 @@ deferred class URI_ROUTED_APPLICATION inherit - ROUTED_APPLICATION_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT_I], REQUEST_URI_HANDLER_CONTEXT_I] + ROUTED_APPLICATION_I [REQUEST_HANDLER [REQUEST_URI_HANDLER_CONTEXT], REQUEST_URI_HANDLER_CONTEXT] redefine router end diff --git a/library/server/request/router/src/uri/request_uri_handler_context_i.e b/library/server/request/router/src/uri/request_uri_handler_context.e similarity index 96% rename from library/server/request/router/src/uri/request_uri_handler_context_i.e rename to library/server/request/router/src/uri/request_uri_handler_context.e index c5289fe5..bfb167f1 100644 --- a/library/server/request/router/src/uri/request_uri_handler_context_i.e +++ b/library/server/request/router/src/uri/request_uri_handler_context.e @@ -5,7 +5,7 @@ note revision: "$Revision$" class - REQUEST_URI_HANDLER_CONTEXT_I + REQUEST_URI_HANDLER_CONTEXT inherit REQUEST_HANDLER_CONTEXT diff --git a/library/server/request/router/src/uri/request_uri_router_i.e b/library/server/request/router/src/uri/request_uri_router_i.e index 0b927fcb..b699f6c0 100644 --- a/library/server/request/router/src/uri/request_uri_router_i.e +++ b/library/server/request/router/src/uri/request_uri_router_i.e @@ -5,7 +5,7 @@ note revision: "$Revision$" class - REQUEST_URI_ROUTER_I [H -> REQUEST_HANDLER [C], C -> REQUEST_URI_HANDLER_CONTEXT_I create make end] + REQUEST_URI_ROUTER_I [H -> REQUEST_HANDLER [C], C -> REQUEST_URI_HANDLER_CONTEXT create make end] inherit REQUEST_ROUTER [H, C] diff --git a/library/server/request/router/src/uri/request_uri_routing_handler_i.e b/library/server/request/router/src/uri/request_uri_routing_handler_i.e index 413cc987..9a05d72e 100644 --- a/library/server/request/router/src/uri/request_uri_routing_handler_i.e +++ b/library/server/request/router/src/uri/request_uri_routing_handler_i.e @@ -6,7 +6,7 @@ note class REQUEST_URI_ROUTING_HANDLER_I [H -> REQUEST_HANDLER [C], - C -> REQUEST_URI_HANDLER_CONTEXT_I create make end] + C -> REQUEST_URI_HANDLER_CONTEXT create make end] inherit REQUEST_ROUTING_HANDLER [H, C] diff --git a/library/server/request/router/src/default/request_uri_template_router.e b/library/server/request/router/src/uri_template/default/request_uri_template_router.e similarity index 89% rename from library/server/request/router/src/default/request_uri_template_router.e rename to library/server/request/router/src/uri_template/default/request_uri_template_router.e index f0f9687e..41cefe4f 100644 --- a/library/server/request/router/src/default/request_uri_template_router.e +++ b/library/server/request/router/src/uri_template/default/request_uri_template_router.e @@ -8,7 +8,7 @@ class REQUEST_URI_TEMPLATE_ROUTER inherit - REQUEST_URI_TEMPLATE_ROUTER_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I] + REQUEST_URI_TEMPLATE_ROUTER_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] redefine map_agent_with_request_methods end @@ -18,10 +18,10 @@ create feature -- Mapping - map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]; + map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER]]; rqst_methods: detachable ARRAY [READABLE_STRING_8]) local - h: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I] + h: REQUEST_AGENT_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] do create h.make (a_action) map_with_request_methods (a_id, h, rqst_methods) diff --git a/library/server/request/router/src/default/request_uri_template_routing_handler.e b/library/server/request/router/src/uri_template/default/request_uri_template_routing_handler.e similarity index 90% rename from library/server/request/router/src/default/request_uri_template_routing_handler.e rename to library/server/request/router/src/uri_template/default/request_uri_template_routing_handler.e index 0df31c5c..2e4a5aa4 100644 --- a/library/server/request/router/src/default/request_uri_template_routing_handler.e +++ b/library/server/request/router/src/uri_template/default/request_uri_template_routing_handler.e @@ -8,7 +8,7 @@ class REQUEST_URI_TEMPLATE_ROUTING_HANDLER inherit - REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I] + REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] redefine router end diff --git a/library/server/request/router/src/default/uri_template_routed_application.e b/library/server/request/router/src/uri_template/default/uri_template_routed_application.e similarity index 92% rename from library/server/request/router/src/default/uri_template_routed_application.e rename to library/server/request/router/src/uri_template/default/uri_template_routed_application.e index 8e33f204..bee5564c 100644 --- a/library/server/request/router/src/default/uri_template_routed_application.e +++ b/library/server/request/router/src/uri_template/default/uri_template_routed_application.e @@ -8,7 +8,7 @@ deferred class URI_TEMPLATE_ROUTED_APPLICATION inherit - ROUTED_APPLICATION_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I] + ROUTED_APPLICATION_I [REQUEST_HANDLER [REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] redefine router end diff --git a/library/server/request/router/src/uri_template/request_uri_template_handler_context_i.e b/library/server/request/router/src/uri_template/request_uri_template_handler_context.e similarity index 97% rename from library/server/request/router/src/uri_template/request_uri_template_handler_context_i.e rename to library/server/request/router/src/uri_template/request_uri_template_handler_context.e index 312aaaf8..5cf1c7db 100644 --- a/library/server/request/router/src/uri_template/request_uri_template_handler_context_i.e +++ b/library/server/request/router/src/uri_template/request_uri_template_handler_context.e @@ -5,7 +5,7 @@ note revision: "$Revision$" class - REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I + REQUEST_URI_TEMPLATE_HANDLER_CONTEXT inherit REQUEST_HANDLER_CONTEXT diff --git a/library/server/request/router/src/uri_template/request_uri_template_router_i.e b/library/server/request/router/src/uri_template/request_uri_template_router_i.e index 2bfb0b6c..d2f61c4d 100644 --- a/library/server/request/router/src/uri_template/request_uri_template_router_i.e +++ b/library/server/request/router/src/uri_template/request_uri_template_router_i.e @@ -5,7 +5,7 @@ note revision: "$Revision$" class - REQUEST_URI_TEMPLATE_ROUTER_I [H -> REQUEST_HANDLER [C], C -> REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I create make end] + REQUEST_URI_TEMPLATE_ROUTER_I [H -> REQUEST_HANDLER [C], C -> REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end] inherit REQUEST_ROUTER [H, C] diff --git a/library/server/request/router/src/uri_template/request_uri_template_routing_handler_i.e b/library/server/request/router/src/uri_template/request_uri_template_routing_handler_i.e index 6e2bfc21..32fd135c 100644 --- a/library/server/request/router/src/uri_template/request_uri_template_routing_handler_i.e +++ b/library/server/request/router/src/uri_template/request_uri_template_routing_handler_i.e @@ -6,7 +6,7 @@ note class REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [H -> REQUEST_HANDLER [C], - C -> REQUEST_URI_TEMPLATE_HANDLER_CONTEXT_I create make end] + C -> REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end] inherit REQUEST_ROUTING_HANDLER [H, C]