- Adopted deferred WGI_VALUE design for Result type of *_parameter and similar functions
- Adopted the ITERATION_CURSOR [WGI_VALUE] design for *_parameters and similar functions - renamed parameter as item - provided helper function to handle "string" value parameters Experimental for now.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
note
|
||||
description: "Summary description for {WGI_STRING_VALUE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WGI_STRING_VALUE
|
||||
|
||||
inherit
|
||||
WGI_VALUE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
as_string: {READABLE_STRING_32, STRING_32}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; a_value: like value)
|
||||
do
|
||||
name := a_name
|
||||
value := a_value
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_GENERAL
|
||||
|
||||
value: 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)
|
||||
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
|
||||
do
|
||||
v := value
|
||||
if v = a_other then
|
||||
Result := True
|
||||
elseif v.is_valid_as_string_8 then
|
||||
Result := v.is_case_insensitive_equal (a_other)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
as_string: STRING_32
|
||||
do
|
||||
create Result.make_from_string (value)
|
||||
end
|
||||
|
||||
;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
|
||||
@@ -89,14 +89,14 @@ feature -- Access: extra values
|
||||
|
||||
feature -- Access: CGI meta variables
|
||||
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
meta_variable (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
||||
-- Environment variable related to `a_name'
|
||||
require
|
||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
deferred
|
||||
end
|
||||
|
||||
meta_variables: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
meta_variables: ITERATION_CURSOR [WGI_VALUE]
|
||||
-- These variables are specific to requests made with HTTP.
|
||||
-- Interpretation of these variables may depend on the value of
|
||||
-- SERVER_PROTOCOL.
|
||||
@@ -575,28 +575,14 @@ feature -- Extra CGI environment variables
|
||||
deferred
|
||||
end
|
||||
|
||||
--feature -- Access: execution variables
|
||||
|
||||
-- execution_variables: WGI_VARIABLES [STRING_32]
|
||||
-- -- Execution variables set by the application
|
||||
-- deferred
|
||||
-- end
|
||||
|
||||
-- execution_variable (a_name: STRING): detachable STRING_32
|
||||
-- -- Execution variable related to `a_name'
|
||||
-- require
|
||||
-- a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
-- deferred
|
||||
-- end
|
||||
|
||||
feature -- Query string Parameters
|
||||
|
||||
query_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
query_parameters: ITERATION_CURSOR [WGI_VALUE]
|
||||
-- Variables extracted from QUERY_STRING
|
||||
deferred
|
||||
end
|
||||
|
||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
||||
-- Parameter for name `n'.
|
||||
require
|
||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
@@ -605,12 +591,12 @@ feature -- Query string Parameters
|
||||
|
||||
feature -- Form fields and related
|
||||
|
||||
form_data_parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
form_data_parameters: ITERATION_CURSOR [WGI_VALUE]
|
||||
-- Variables sent by POST request
|
||||
deferred
|
||||
end
|
||||
|
||||
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
||||
-- Field for name `a_name'.
|
||||
require
|
||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
@@ -630,12 +616,12 @@ feature -- Form fields and related
|
||||
|
||||
feature -- Cookies
|
||||
|
||||
cookies: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
cookies: ITERATION_CURSOR [WGI_VALUE]
|
||||
-- Expanded cookies variable
|
||||
deferred
|
||||
end
|
||||
|
||||
cookie (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
cookie (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
||||
-- Field for name `a_name'.
|
||||
require
|
||||
a_name_valid: a_name /= Void and then not a_name.is_empty
|
||||
@@ -644,14 +630,26 @@ feature -- Cookies
|
||||
|
||||
feature -- Access: global variable
|
||||
|
||||
parameters: HASH_TABLE [READABLE_STRING_32, READABLE_STRING_GENERAL]
|
||||
parameters: like items
|
||||
obsolete "use items"
|
||||
do
|
||||
Result := items
|
||||
end
|
||||
|
||||
parameter (a_name: READABLE_STRING_GENERAL): like item
|
||||
obsolete "use item"
|
||||
do
|
||||
Result := item (a_name)
|
||||
end
|
||||
|
||||
items: ITERATION_CURSOR [WGI_VALUE]
|
||||
-- Table containing all the various variables
|
||||
-- Warning: this is computed each time, if you change the content of other containers
|
||||
-- this won't update this Result's content, unless you query it again
|
||||
deferred
|
||||
end
|
||||
|
||||
parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
item (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
|
||||
-- Variable named `a_name' from any of the variables container
|
||||
-- and following a specific order
|
||||
-- execution, environment, get, post, cookies
|
||||
|
||||
48
library/server/ewsgi/specification/request/wgi_value.e
Normal file
48
library/server/ewsgi/specification/request/wgi_value.e
Normal file
@@ -0,0 +1,48 @@
|
||||
note
|
||||
description: "Summary description for {WGI_VALUE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WGI_VALUE
|
||||
|
||||
convert
|
||||
as_string: {READABLE_STRING_32, STRING_32}
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_GENERAL
|
||||
-- Parameter name
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
same_string (a_other: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Does `a_other' represent the same string as `Current'?
|
||||
deferred
|
||||
end
|
||||
|
||||
is_case_insensitive_equal (a_other: READABLE_STRING_8): BOOLEAN
|
||||
-- Does `a_other' represent the same case insensitive string as `Current'?
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
as_string: STRING_32
|
||||
deferred
|
||||
end
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user