Changed ITERATION_CURSOR [WGI_VALUE] into ITERABLE [WGI_VALUE] for WGI_REQUEST.*parameters* and similar

Applied recent changes on EWF_HEADER
This commit is contained in:
Jocelyn Fiat
2011-09-26 17:10:05 +02:00
parent d397d4e35d
commit 738eb7555f
5 changed files with 39 additions and 61 deletions

View File

@@ -30,6 +30,8 @@ feature {NONE} -- Initialization
create_router create_router
do do
-- (create {EXCEPTIONS}).raise ("ouch")
check False end
create router.make (5) create router.make (5)
end end
@@ -75,10 +77,10 @@ feature -- Execution
n: INTEGER n: INTEGER
i: INTEGER i: INTEGER
do do
create h.make
l_url := req.script_url ("/home") l_url := req.script_url ("/home")
n := 3 n := 3
h.put_refresh (l_url, 5, 200) create h.make
h.put_refresh (l_url, 5)
res.set_status_code (200) res.set_status_code (200)
res.write_headers_string (h.string) res.write_headers_string (h.string)
from from

View File

@@ -55,7 +55,7 @@ feature -- Execution
create h.make create h.make
l_url := req.script_url ("/home") l_url := req.script_url ("/home")
n := 3 n := 3
h.put_refresh (l_url, 5, 200) h.put_refresh (l_url, 5)
res.set_status_code (200) res.set_status_code (200)
res.write_headers_string (h.string) res.write_headers_string (h.string)
from from

View File

@@ -106,7 +106,7 @@ feature -- Access: CGI meta variables
end end
end end
meta_variables: ITERATION_CURSOR [WGI_VALUE] meta_variables: ITERABLE [WGI_VALUE]
-- These variables are specific to requests made with HTTP. -- These variables are specific to requests made with HTTP.
-- Interpretation of these variables may depend on the value of -- Interpretation of these variables may depend on the value of
-- SERVER_PROTOCOL. -- SERVER_PROTOCOL.
@@ -587,7 +587,7 @@ feature -- Extra CGI environment variables
feature -- Query string Parameters feature -- Query string Parameters
query_parameters: ITERATION_CURSOR [WGI_VALUE] query_parameters: ITERABLE [WGI_VALUE]
-- Variables extracted from QUERY_STRING -- Variables extracted from QUERY_STRING
deferred deferred
end end
@@ -601,7 +601,7 @@ feature -- Query string Parameters
feature -- Form fields and related feature -- Form fields and related
form_data_parameters: ITERATION_CURSOR [WGI_VALUE] form_data_parameters: ITERABLE [WGI_VALUE]
-- Variables sent by POST request -- Variables sent by POST request
deferred deferred
end end
@@ -626,7 +626,7 @@ feature -- Form fields and related
feature -- Cookies feature -- Cookies
cookies: ITERATION_CURSOR [WGI_VALUE] cookies: ITERABLE [WGI_VALUE]
-- Expanded cookies variable -- Expanded cookies variable
deferred deferred
end end
@@ -652,7 +652,7 @@ feature -- Access: global variable
Result := item (a_name) Result := item (a_name)
end end
items: ITERATION_CURSOR [WGI_VALUE] items: ITERABLE [WGI_VALUE]
-- Table containing all the various variables -- Table containing all the various variables
-- Warning: this is computed each time, if you change the content of other containers -- 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 -- this won't update this Result's content, unless you query it again

View File

@@ -174,9 +174,9 @@ feature {NONE} -- Access: CGI meta parameters
feature -- Access: CGI meta parameters feature -- Access: CGI meta parameters
meta_variables: ITERATION_CURSOR [WGI_VALUE] meta_variables: ITERABLE [WGI_VALUE]
do do
Result := meta_variables_table.new_cursor Result := meta_variables_table
end end
meta_variable (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE meta_variable (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -429,9 +429,9 @@ feature {NONE} -- Query parameters
feature -- Query parameters feature -- Query parameters
query_parameters: ITERATION_CURSOR [WGI_VALUE] query_parameters: ITERABLE [WGI_VALUE]
do do
Result := query_parameters_table.new_cursor Result := query_parameters_table
end end
query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE query_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -538,9 +538,9 @@ feature {NONE} -- Form fields and related
feature -- Form fields and related feature -- Form fields and related
form_data_parameters: ITERATION_CURSOR [WGI_VALUE] form_data_parameters: ITERABLE [WGI_VALUE]
do do
Result := form_data_parameters_table.new_cursor Result := form_data_parameters_table
end end
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -606,9 +606,9 @@ feature {NONE} -- Cookies
feature -- Cookies feature -- Cookies
cookies: ITERATION_CURSOR [WGI_VALUE] cookies: ITERABLE [WGI_VALUE]
do do
Result := cookies_table.new_cursor Result := cookies_table
end end
cookie (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE cookie (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -623,57 +623,40 @@ feature {NONE} -- Access: global variable
-- Table containing all the various variables -- Table containing all the various variables
-- Warning: this is computed each time, if you change the content of other containers -- 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 -- this won't update this Result's content, unless you query it again
local
vars: ITERATION_CURSOR [WGI_VALUE]
do do
create Result.make (100) create Result.make (100)
vars := meta_variables across
from meta_variables as vars
-- vars.start
until
vars.after
loop loop
Result.force (vars.item, vars.item.name) Result.force (vars.item, vars.item.name)
vars.forth
end end
vars := query_parameters across
from query_parameters as vars
-- vars.start
until
vars.after
loop loop
Result.force (vars.item, vars.item.name) Result.force (vars.item, vars.item.name)
vars.forth
end end
vars := form_data_parameters across
from form_data_parameters as vars
-- vars.start
until
vars.after
loop loop
Result.force (vars.item, vars.item.name) Result.force (vars.item, vars.item.name)
vars.forth
end end
vars := cookies across
from cookies as vars
-- vars.start
until
vars.after
loop loop
Result.force (vars.item, vars.item.name) Result.force (vars.item, vars.item.name)
vars.forth
end end
end end
feature -- Access: global variable feature -- Access: global variable
items: ITERATION_CURSOR [WGI_VALUE] items: ITERABLE [WGI_VALUE]
do do
Result := items_table.new_cursor Result := items_table
end end
item (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE item (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE

View File

@@ -46,7 +46,6 @@ feature {NONE} -- Events
execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
local local
q: detachable STRING_32 q: detachable STRING_32
qcur: ITERATION_CURSOR [WGI_VALUE]
do do
if attached req.request_uri as l_uri then if attached req.request_uri as l_uri then
if l_uri.starts_with (test_url ("get/01")) then if l_uri.starts_with (test_url ("get/01")) then
@@ -54,16 +53,13 @@ feature {NONE} -- Events
res.write_string ("get-01") res.write_string ("get-01")
create q.make_empty create q.make_empty
from across
qcur := req.query_parameters req.query_parameters as qcur
until
qcur.after
loop loop
if not q.is_empty then if not q.is_empty then
q.append_character ('&') q.append_character ('&')
end end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string) q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string)
qcur.forth
end end
if not q.is_empty then if not q.is_empty then
res.write_string ("(" + q + ")") res.write_string ("(" + q + ")")
@@ -73,34 +69,31 @@ feature {NONE} -- Events
res.write_string ("post-01") res.write_string ("post-01")
create q.make_empty create q.make_empty
from across
qcur := req.query_parameters req.query_parameters as qcur
until
qcur.after
loop loop
if not q.is_empty then if not q.is_empty then
q.append_character ('&') q.append_character ('&')
end end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string) q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string)
qcur.forth
end end
if not q.is_empty then if not q.is_empty then
res.write_string ("(" + q + ")") res.write_string ("(" + q + ")")
end end
create q.make_empty create q.make_empty
from
qcur := req.form_data_parameters across
until req.form_data_parameters as fcur
qcur.after
loop loop
if not q.is_empty then if not q.is_empty then
q.append_character ('&') q.append_character ('&')
end end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string) q.append (fcur.item.name.as_string_32 + "=" + fcur.item.as_string)
qcur.forth
end end
if not q.is_empty then if not q.is_empty then
res.write_string (" : " + q ) res.write_string (" : " + q )
end end