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
do
-- (create {EXCEPTIONS}).raise ("ouch")
check False end
create router.make (5)
end
@@ -75,10 +77,10 @@ feature -- Execution
n: INTEGER
i: INTEGER
do
create h.make
l_url := req.script_url ("/home")
n := 3
h.put_refresh (l_url, 5, 200)
create h.make
h.put_refresh (l_url, 5)
res.set_status_code (200)
res.write_headers_string (h.string)
from

View File

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

View File

@@ -106,7 +106,7 @@ feature -- Access: CGI meta variables
end
end
meta_variables: ITERATION_CURSOR [WGI_VALUE]
meta_variables: ITERABLE [WGI_VALUE]
-- These variables are specific to requests made with HTTP.
-- Interpretation of these variables may depend on the value of
-- SERVER_PROTOCOL.
@@ -587,7 +587,7 @@ feature -- Extra CGI environment variables
feature -- Query string Parameters
query_parameters: ITERATION_CURSOR [WGI_VALUE]
query_parameters: ITERABLE [WGI_VALUE]
-- Variables extracted from QUERY_STRING
deferred
end
@@ -601,7 +601,7 @@ feature -- Query string Parameters
feature -- Form fields and related
form_data_parameters: ITERATION_CURSOR [WGI_VALUE]
form_data_parameters: ITERABLE [WGI_VALUE]
-- Variables sent by POST request
deferred
end
@@ -626,7 +626,7 @@ feature -- Form fields and related
feature -- Cookies
cookies: ITERATION_CURSOR [WGI_VALUE]
cookies: ITERABLE [WGI_VALUE]
-- Expanded cookies variable
deferred
end
@@ -652,7 +652,7 @@ feature -- Access: global variable
Result := item (a_name)
end
items: ITERATION_CURSOR [WGI_VALUE]
items: ITERABLE [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

View File

@@ -174,9 +174,9 @@ feature {NONE} -- Access: CGI meta parameters
feature -- Access: CGI meta parameters
meta_variables: ITERATION_CURSOR [WGI_VALUE]
meta_variables: ITERABLE [WGI_VALUE]
do
Result := meta_variables_table.new_cursor
Result := meta_variables_table
end
meta_variable (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -429,9 +429,9 @@ feature {NONE} -- Query parameters
feature -- Query parameters
query_parameters: ITERATION_CURSOR [WGI_VALUE]
query_parameters: ITERABLE [WGI_VALUE]
do
Result := query_parameters_table.new_cursor
Result := query_parameters_table
end
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
form_data_parameters: ITERATION_CURSOR [WGI_VALUE]
form_data_parameters: ITERABLE [WGI_VALUE]
do
Result := form_data_parameters_table.new_cursor
Result := form_data_parameters_table
end
form_data_parameter (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -606,9 +606,9 @@ feature {NONE} -- Cookies
feature -- Cookies
cookies: ITERATION_CURSOR [WGI_VALUE]
cookies: ITERABLE [WGI_VALUE]
do
Result := cookies_table.new_cursor
Result := cookies_table
end
cookie (a_name: READABLE_STRING_GENERAL): detachable WGI_VALUE
@@ -623,57 +623,40 @@ feature {NONE} -- Access: global variable
-- 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
local
vars: ITERATION_CURSOR [WGI_VALUE]
do
create Result.make (100)
vars := meta_variables
from
-- vars.start
until
vars.after
across
meta_variables as vars
loop
Result.force (vars.item, vars.item.name)
vars.forth
end
vars := query_parameters
from
-- vars.start
until
vars.after
across
query_parameters as vars
loop
Result.force (vars.item, vars.item.name)
vars.forth
end
vars := form_data_parameters
from
-- vars.start
until
vars.after
across
form_data_parameters as vars
loop
Result.force (vars.item, vars.item.name)
vars.forth
end
vars := cookies
from
-- vars.start
until
vars.after
across
cookies as vars
loop
Result.force (vars.item, vars.item.name)
vars.forth
end
end
feature -- Access: global variable
items: ITERATION_CURSOR [WGI_VALUE]
items: ITERABLE [WGI_VALUE]
do
Result := items_table.new_cursor
Result := items_table
end
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)
local
q: detachable STRING_32
qcur: ITERATION_CURSOR [WGI_VALUE]
do
if attached req.request_uri as l_uri then
if l_uri.starts_with (test_url ("get/01")) then
@@ -54,16 +53,13 @@ feature {NONE} -- Events
res.write_string ("get-01")
create q.make_empty
from
qcur := req.query_parameters
until
qcur.after
across
req.query_parameters as qcur
loop
if not q.is_empty then
q.append_character ('&')
end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string)
qcur.forth
end
if not q.is_empty then
res.write_string ("(" + q + ")")
@@ -73,34 +69,31 @@ feature {NONE} -- Events
res.write_string ("post-01")
create q.make_empty
from
qcur := req.query_parameters
until
qcur.after
across
req.query_parameters as qcur
loop
if not q.is_empty then
q.append_character ('&')
end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string)
qcur.forth
end
if not q.is_empty then
res.write_string ("(" + q + ")")
end
create q.make_empty
from
qcur := req.form_data_parameters
until
qcur.after
across
req.form_data_parameters as fcur
loop
if not q.is_empty then
q.append_character ('&')
end
q.append (qcur.item.name.as_string_32 + "=" + qcur.item.as_string)
qcur.forth
q.append (fcur.item.name.as_string_32 + "=" + fcur.item.as_string)
end
if not q.is_empty then
res.write_string (" : " + q )
end