Apply prefix renaming from the specification

Reduced the number of EWSGI classes
This commit is contained in:
Jocelyn Fiat
2011-07-27 15:56:44 +02:00
parent e5fb3f8328
commit e883163fe9
12 changed files with 53 additions and 52 deletions

View File

@@ -45,7 +45,7 @@ feature -- Access: environment variables
feature -- Access: execution variables
execution_variables: EWSGI_EXECUTION_VARIABLES
execution_variables: EWSGI_VARIABLES [STRING_32]
-- Execution variables set by the application
deferred
end
@@ -59,7 +59,7 @@ feature -- Access: execution variables
feature -- URL Parameters
parameters: EWSGI_REQUEST_VARIABLES
parameters: EWSGI_VARIABLES [STRING_32]
-- Variables extracted from QUERY_STRING
deferred
end
@@ -73,7 +73,7 @@ feature -- URL Parameters
feature -- Form fields and related
form_fields: EWSGI_REQUEST_VARIABLES
form_fields: EWSGI_VARIABLES [STRING_32]
-- Variables sent by POST request
deferred
end

View File

@@ -10,6 +10,9 @@ note
deferred class
EWSGI_VARIABLES [G -> STRING_GENERAL]
inherit
ITERABLE [G]
feature -- Status report
has_variable (a_name: STRING): BOOLEAN

View File

@@ -36,7 +36,7 @@ feature -- Status writing
put_status_line (a_code: INTEGER)
-- Put status code line for `a_code'
--| Note this is a default implemantation, and could be redefined
--| Note this is a default implementation, and could be redefined
--| for instance in relation to NPH CGI script
local
s: STRING

View File

@@ -9,7 +9,7 @@ deferred class
GW_APPLICATION_IMP
inherit
GW_APPLICATION
EWSGI_APPLICATION
redefine
process,
rescue_execute
@@ -22,14 +22,14 @@ feature -- Access
feature -- Execution
process (env: GW_ENVIRONMENT; a_input: GW_INPUT_STREAM; a_output: GW_OUTPUT_STREAM)
process (env: EWSGI_ENVIRONMENT; a_input: EWSGI_INPUT_STREAM; a_output: EWSGI_OUTPUT_STREAM)
-- Process request with environment `env', and i/o streams `a_input' and `a_output'
do
request_count := request_count + 1
Precursor (env, a_input, a_output)
end
rescue_execute (req: detachable GW_REQUEST; res: detachable GW_RESPONSE; a_exception: detachable EXCEPTION)
rescue_execute (req: detachable EWSGI_REQUEST; res: detachable EWSGI_RESPONSE; a_exception: detachable EXCEPTION)
-- Operation processed on rescue of `execute'
do
if
@@ -44,13 +44,13 @@ feature -- Execution
feature -- Factory
new_request (env: GW_ENVIRONMENT; a_input: GW_INPUT_STREAM): GW_REQUEST
new_request (env: EWSGI_ENVIRONMENT; a_input: EWSGI_INPUT_STREAM): EWSGI_REQUEST
do
create {GW_REQUEST_IMP} Result.make (env, a_input)
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
end
new_response (req: GW_REQUEST; a_output: GW_OUTPUT_STREAM): GW_RESPONSE
new_response (req: EWSGI_REQUEST; a_output: EWSGI_OUTPUT_STREAM): EWSGI_RESPONSE
do
create {GW_RESPONSE_IMP} Result.make (a_output)
end

View File

@@ -5,7 +5,7 @@ note
You can create your own descendant of this class to
add/remove specific value or processing
This object is created by {GW_APPLICATION}.new_request
This object is created by {EWSGI_APPLICATION}.new_request
]"
legal: "See notice at end of class."
status: "See notice at end of class."
@@ -16,14 +16,14 @@ class
GW_REQUEST_IMP
inherit
GW_REQUEST
EWSGI_REQUEST
create
make
feature {NONE} -- Initialization
make (env: GW_ENVIRONMENT; a_input: like input)
make (env: EWSGI_ENVIRONMENT; a_input: like input)
require
env_attached: env /= Void
do
@@ -53,13 +53,13 @@ feature {NONE} -- Initialization
if attached env.request_uri as rq_uri then
p := rq_uri.index_of ('?', 1)
if p > 0 then
env.set_variable (rq_uri.substring (1, p-1), {GW_ENVIRONMENT_NAMES}.self)
env.set_variable (rq_uri.substring (1, p-1), {EWSGI_ENVIRONMENT_NAMES}.self)
else
env.set_variable (rq_uri, {GW_ENVIRONMENT_NAMES}.self)
env.set_variable (rq_uri, {EWSGI_ENVIRONMENT_NAMES}.self)
end
end
if env.variable ({GW_ENVIRONMENT_NAMES}.request_time) = Void then
env.set_variable (date_time_utilities.unix_time_stamp (Void).out, {GW_ENVIRONMENT_NAMES}.request_time)
if env.variable ({EWSGI_ENVIRONMENT_NAMES}.request_time) = Void then
env.set_variable (date_time_utilities.unix_time_stamp (Void).out, {EWSGI_ENVIRONMENT_NAMES}.request_time)
end
end
@@ -71,7 +71,7 @@ feature {NONE} -- Initialization
feature -- Access: Input
input: GW_INPUT_STREAM
input: EWSGI_INPUT_STREAM
-- Server input channel
feature -- Status
@@ -95,7 +95,7 @@ feature -- Error handling
feature -- Access: environment variables
environment: GW_ENVIRONMENT
environment: EWSGI_ENVIRONMENT
-- Environment variables
environment_variable (a_name: STRING): detachable STRING
@@ -202,7 +202,7 @@ feature -- Form fields and related
Result := form_fields.variable (a_name)
end
uploaded_files: HASH_TABLE [GW_UPLOADED_FILE_DATA, STRING]
uploaded_files: HASH_TABLE [EWSGI_UPLOADED_FILE_DATA, STRING]
-- Table of uploaded files information
--| name: original path from the user
--| type: content type
@@ -248,7 +248,7 @@ feature -- Cookies
Result := cookies_variables.item (a_name)
end
cookies: HASH_TABLE [GW_COOKIE, STRING]
cookies: HASH_TABLE [EWSGI_COOKIE, STRING]
-- Cookies Information
local
i,j,p,n: INTEGER
@@ -257,7 +257,7 @@ feature -- Cookies
do
l_cookies := internal_cookies
if l_cookies = Void then
if attached environment_variable ({GW_ENVIRONMENT_NAMES}.http_cookie) as s then
if attached environment_variable ({EWSGI_ENVIRONMENT_NAMES}.http_cookie) as s then
create l_cookies.make (5)
from
n := s.count
@@ -280,7 +280,7 @@ feature -- Cookies
v := s.substring (i + 1, j - 1)
p := j + 1
end
l_cookies.put (create {GW_COOKIE}.make (k,v), k)
l_cookies.put (create {EWSGI_COOKIE}.make (k,v), k)
end
end
else
@@ -385,7 +385,7 @@ feature -- Access extra information
-- Request time (UTC)
do
if
attached environment.variable ({GW_ENVIRONMENT_NAMES}.request_time) as t and then
attached environment.variable ({EWSGI_ENVIRONMENT_NAMES}.request_time) as t and then
t.is_integer_64
then
Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64)
@@ -466,7 +466,7 @@ feature -- Element change
error_handler := ehdl
end
update_path_info (env: GW_ENVIRONMENT)
update_path_info (env: EWSGI_ENVIRONMENT)
-- Fix and update PATH_INFO value if needed
local
l_path_info: STRING
@@ -513,7 +513,7 @@ feature -- Uploaded File Handling
feature {NONE} -- Temporary File handling
delete_uploaded_file (uf: GW_UPLOADED_FILE_DATA)
delete_uploaded_file (uf: EWSGI_UPLOADED_FILE_DATA)
-- Delete file `a_filename'
require
uf_valid: uf /= Void
@@ -536,7 +536,7 @@ feature {NONE} -- Temporary File handling
end
end
save_uploaded_file (a_content: STRING; a_up_fn_info: GW_UPLOADED_FILE_DATA)
save_uploaded_file (a_content: STRING; a_up_fn_info: EWSGI_UPLOADED_FILE_DATA)
-- Save uploaded file content to `a_filename'
local
bn: STRING
@@ -703,7 +703,7 @@ feature {NONE} -- Implementation: Form analyzer
l_header: detachable STRING
l_content: detachable STRING
l_line: detachable STRING
l_up_file_info: GW_UPLOADED_FILE_DATA
l_up_file_info: EWSGI_UPLOADED_FILE_DATA
do
from
p := 1

View File

@@ -8,12 +8,12 @@ class
GW_IN_MEMORY_RESPONSE
inherit
GW_RESPONSE
EWSGI_RESPONSE
redefine
commit
end
create {GW_APPLICATION}
create {EWSGI_APPLICATION}
make
feature {NONE} -- Initialization
@@ -104,9 +104,9 @@ feature -- Header output operation
header := h
end
feature {GW_APPLICATION} -- Commit
feature {EWSGI_APPLICATION} -- Commit
commit (a_output: GW_OUTPUT_STREAM)
commit (a_output: EWSGI_OUTPUT_STREAM)
do
a_output.put_status_line (status_code)
a_output.put_string (header.string)

View File

@@ -8,7 +8,7 @@ deferred class
GW_IN_MEMORY_RESPONSE_APPLICATION
inherit
GW_APPLICATION
EWSGI_APPLICATION
redefine
process
end
@@ -20,7 +20,7 @@ feature -- Access
feature -- Execution
process (env: GW_ENVIRONMENT; a_input: GW_INPUT_STREAM; a_output: GW_OUTPUT_STREAM)
process (env: EWSGI_ENVIRONMENT; a_input: EWSGI_INPUT_STREAM; a_output: EWSGI_OUTPUT_STREAM)
-- Process request with environment `env', and i/o streams `a_input' and `a_output'
do
request_count := request_count + 1
@@ -29,13 +29,13 @@ feature -- Execution
feature -- Factory
new_request (env: GW_ENVIRONMENT; a_input: GW_INPUT_STREAM): GW_REQUEST
new_request (env: EWSGI_ENVIRONMENT; a_input: EWSGI_INPUT_STREAM): EWSGI_REQUEST
do
create {GW_REQUEST_IMP} Result.make (env, a_input)
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
end
new_response (req: GW_REQUEST; a_output: GW_OUTPUT_STREAM): GW_IN_MEMORY_RESPONSE
new_response (req: EWSGI_REQUEST; a_output: EWSGI_OUTPUT_STREAM): GW_IN_MEMORY_RESPONSE
do
create {GW_IN_MEMORY_RESPONSE} Result.make
end

View File

@@ -1,12 +1,12 @@
note
description: "Summary description for {EWSGI_ENVIRONMENT_VARIABLES}."
description: "Summary description for {GW_ENVIRONMENT_VARIABLES}."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
EWSGI_ENVIRONMENT_VARIABLES
GW_ENVIRONMENT_VARIABLES
inherit
EWSGI_ENVIRONMENT

View File

@@ -1,12 +1,12 @@
note
description: "Summary description for {EWSGI_EXECUTION_VARIABLES}."
description: "Summary description for {GW_EXECUTION_VARIABLES}."
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date$"
revision: "$Revision$"
class
EWSGI_EXECUTION_VARIABLES
GW_EXECUTION_VARIABLES
inherit
EWSGI_VARIABLES [STRING_32]

View File

@@ -8,13 +8,11 @@ note
revision: "$Revision$"
class
EWSGI_REQUEST_VARIABLES
GW_REQUEST_VARIABLES
inherit
EWSGI_VARIABLES [STRING_32]
ITERABLE [STRING_32]
create
make,
make_from_urlencoded

View File

@@ -8,9 +8,9 @@ class
GW_BUFFERED_RESPONSE
inherit
GW_RESPONSE
EWSGI_RESPONSE
create {GW_APPLICATION}
create {EWSGI_APPLICATION}
make
feature {NONE} -- Initialization
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
create buffer.make (a_buffer_size)
end
output: GW_OUTPUT_STREAM
output: EWSGI_OUTPUT_STREAM
buffer: STRING_8
@@ -143,9 +143,9 @@ feature {NONE} -- Implementation
buffer_flushed: buffer_count = 0 and buffer.count = 0
end
feature {GW_APPLICATION} -- Commit
feature {EWSGI_APPLICATION} -- Commit
commit (a_output: GW_OUTPUT_STREAM)
commit (a_output: EWSGI_OUTPUT_STREAM)
do
flush_buffer
a_output.flush

View File

@@ -8,9 +8,9 @@ class
GW_RESPONSE_IMP
inherit
GW_RESPONSE
EWSGI_RESPONSE
create {GW_APPLICATION}
create {EWSGI_APPLICATION}
make
feature {NONE} -- Initialization
@@ -20,9 +20,9 @@ feature {NONE} -- Initialization
output := a_output
end
feature {GW_APPLICATION} -- Commit
feature {EWSGI_APPLICATION} -- Commit
commit (a_output_stream: GW_OUTPUT_STREAM)
commit (a_output_stream: EWSGI_OUTPUT_STREAM)
-- Commit the current response
do
a_output_stream.flush
@@ -94,7 +94,7 @@ feature -- Header output operation
feature {NONE} -- Implementation: Access
output: GW_OUTPUT_STREAM
output: EWSGI_OUTPUT_STREAM
-- Server output channel
;note