removed the notion of status from GW_HEADER, since it should not be part of the HTTP header

added status setting in GW_RESPONSE
added a default implementation for write_status in OUTPUT_STREAM
  (it should be moved away in the future)
removed any implementation from GW_REQUEST, and put it in GW_REQUEST_IMP
This commit is contained in:
Jocelyn Fiat
2011-07-27 14:51:47 +02:00
parent 65800371cd
commit 4075b08b7e
8 changed files with 259 additions and 193 deletions

View File

@@ -98,6 +98,12 @@ feature -- Access: environment variables
environment: GW_ENVIRONMENT
-- Environment variables
environment_variable (a_name: STRING): detachable STRING
-- Environment variable related to `a_name'
do
Result := environment.variable (a_name)
end
content_length: INTEGER
-- Extracted Content-Length value
@@ -106,6 +112,12 @@ feature -- Access: execution variables
execution_variables: GW_EXECUTION_VARIABLES
-- Execution variables set by the application
execution_variable (a_name: STRING): detachable STRING_32
-- Execution variable related to `a_name'
do
Result := execution_variables.variable (a_name)
end
feature -- URL parameters
parameters: GW_REQUEST_VARIABLES
@@ -141,6 +153,12 @@ feature -- URL parameters
Result := vars
end
parameter (a_name: STRING): detachable STRING_32
-- Parameter for name `n'.
do
Result := parameters.variable (a_name)
end
feature -- Form fields and related
form_fields: GW_REQUEST_VARIABLES
@@ -178,6 +196,12 @@ feature -- Form fields and related
Result := vars
end
form_field (a_name: STRING): detachable STRING_32
-- Field for name `a_name'.
do
Result := form_fields.variable (a_name)
end
uploaded_files: HASH_TABLE [GW_UPLOADED_FILE_DATA, STRING]
-- Table of uploaded files information
--| name: original path from the user
@@ -218,6 +242,12 @@ feature -- Cookies
end
end
cookies_variable (a_name: STRING): detachable STRING
-- Field for name `a_name'.
do
Result := cookies_variables.item (a_name)
end
cookies: HASH_TABLE [GW_COOKIE, STRING]
-- Cookies Information
local
@@ -261,6 +291,94 @@ feature -- Cookies
Result := l_cookies
end
feature -- Access: global variable
variables: HASH_TABLE [STRING_32, STRING_32]
-- 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: HASH_TABLE [STRING_GENERAL, STRING_GENERAL]
do
create Result.make (100)
vars := execution_variables
from
vars.start
until
vars.after
loop
Result.put (vars.item_for_iteration, vars.key_for_iteration)
vars.forth
end
vars := environment.table
from
vars.start
until
vars.after
loop
Result.put (vars.item_for_iteration, vars.key_for_iteration)
vars.forth
end
vars := parameters.table
from
vars.start
until
vars.after
loop
Result.put (vars.item_for_iteration, vars.key_for_iteration)
vars.forth
end
vars := form_fields.table
from
vars.start
until
vars.after
loop
Result.put (vars.item_for_iteration, vars.key_for_iteration)
vars.forth
end
vars := cookies_variables
from
vars.start
until
vars.after
loop
Result.put (vars.item_for_iteration, vars.key_for_iteration)
vars.forth
end
end
variable (a_name: STRING_8): detachable STRING_32
-- Variable named `a_name' from any of the variables container
-- and following a specific order
-- execution, environment, get, post, cookies
local
s: detachable STRING_GENERAL
do
s := execution_variable (a_name)
if s = Void then
s := environment_variable (a_name)
if s = Void then
s := parameter (a_name)
if s = Void then
s := form_field (a_name)
if s = Void then
s := cookies_variable (a_name)
end
end
end
end
if s /= Void then
Result := s.as_string_32
end
end
feature -- Access extra information
request_time: detachable DATE_TIME
@@ -397,6 +515,8 @@ feature {NONE} -- Temporary File handling
delete_uploaded_file (uf: GW_UPLOADED_FILE_DATA)
-- Delete file `a_filename'
require
uf_valid: uf /= Void
local
f: RAW_FILE
do