Apply prefix renaming from the specification
Reduced the number of EWSGI classes
This commit is contained in:
@@ -45,7 +45,7 @@ feature -- Access: environment variables
|
|||||||
|
|
||||||
feature -- Access: execution variables
|
feature -- Access: execution variables
|
||||||
|
|
||||||
execution_variables: EWSGI_EXECUTION_VARIABLES
|
execution_variables: EWSGI_VARIABLES [STRING_32]
|
||||||
-- Execution variables set by the application
|
-- Execution variables set by the application
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
@@ -59,7 +59,7 @@ feature -- Access: execution variables
|
|||||||
|
|
||||||
feature -- URL Parameters
|
feature -- URL Parameters
|
||||||
|
|
||||||
parameters: EWSGI_REQUEST_VARIABLES
|
parameters: EWSGI_VARIABLES [STRING_32]
|
||||||
-- Variables extracted from QUERY_STRING
|
-- Variables extracted from QUERY_STRING
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
@@ -73,7 +73,7 @@ feature -- URL Parameters
|
|||||||
|
|
||||||
feature -- Form fields and related
|
feature -- Form fields and related
|
||||||
|
|
||||||
form_fields: EWSGI_REQUEST_VARIABLES
|
form_fields: EWSGI_VARIABLES [STRING_32]
|
||||||
-- Variables sent by POST request
|
-- Variables sent by POST request
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ note
|
|||||||
deferred class
|
deferred class
|
||||||
EWSGI_VARIABLES [G -> STRING_GENERAL]
|
EWSGI_VARIABLES [G -> STRING_GENERAL]
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ITERABLE [G]
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
has_variable (a_name: STRING): BOOLEAN
|
has_variable (a_name: STRING): BOOLEAN
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ feature -- Status writing
|
|||||||
|
|
||||||
put_status_line (a_code: INTEGER)
|
put_status_line (a_code: INTEGER)
|
||||||
-- Put status code line for `a_code'
|
-- 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
|
--| for instance in relation to NPH CGI script
|
||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ deferred class
|
|||||||
GW_APPLICATION_IMP
|
GW_APPLICATION_IMP
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_APPLICATION
|
EWSGI_APPLICATION
|
||||||
redefine
|
redefine
|
||||||
process,
|
process,
|
||||||
rescue_execute
|
rescue_execute
|
||||||
@@ -22,14 +22,14 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Execution
|
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'
|
-- Process request with environment `env', and i/o streams `a_input' and `a_output'
|
||||||
do
|
do
|
||||||
request_count := request_count + 1
|
request_count := request_count + 1
|
||||||
Precursor (env, a_input, a_output)
|
Precursor (env, a_input, a_output)
|
||||||
end
|
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'
|
-- Operation processed on rescue of `execute'
|
||||||
do
|
do
|
||||||
if
|
if
|
||||||
@@ -44,13 +44,13 @@ feature -- Execution
|
|||||||
|
|
||||||
feature -- Factory
|
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
|
do
|
||||||
create {GW_REQUEST_IMP} Result.make (env, a_input)
|
create {GW_REQUEST_IMP} Result.make (env, a_input)
|
||||||
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
|
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
|
||||||
end
|
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
|
do
|
||||||
create {GW_RESPONSE_IMP} Result.make (a_output)
|
create {GW_RESPONSE_IMP} Result.make (a_output)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ note
|
|||||||
You can create your own descendant of this class to
|
You can create your own descendant of this class to
|
||||||
add/remove specific value or processing
|
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."
|
legal: "See notice at end of class."
|
||||||
status: "See notice at end of class."
|
status: "See notice at end of class."
|
||||||
@@ -16,14 +16,14 @@ class
|
|||||||
GW_REQUEST_IMP
|
GW_REQUEST_IMP
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_REQUEST
|
EWSGI_REQUEST
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (env: GW_ENVIRONMENT; a_input: like input)
|
make (env: EWSGI_ENVIRONMENT; a_input: like input)
|
||||||
require
|
require
|
||||||
env_attached: env /= Void
|
env_attached: env /= Void
|
||||||
do
|
do
|
||||||
@@ -53,13 +53,13 @@ feature {NONE} -- Initialization
|
|||||||
if attached env.request_uri as rq_uri then
|
if attached env.request_uri as rq_uri then
|
||||||
p := rq_uri.index_of ('?', 1)
|
p := rq_uri.index_of ('?', 1)
|
||||||
if p > 0 then
|
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
|
else
|
||||||
env.set_variable (rq_uri, {GW_ENVIRONMENT_NAMES}.self)
|
env.set_variable (rq_uri, {EWSGI_ENVIRONMENT_NAMES}.self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if env.variable ({GW_ENVIRONMENT_NAMES}.request_time) = Void then
|
if env.variable ({EWSGI_ENVIRONMENT_NAMES}.request_time) = Void then
|
||||||
env.set_variable (date_time_utilities.unix_time_stamp (Void).out, {GW_ENVIRONMENT_NAMES}.request_time)
|
env.set_variable (date_time_utilities.unix_time_stamp (Void).out, {EWSGI_ENVIRONMENT_NAMES}.request_time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access: Input
|
feature -- Access: Input
|
||||||
|
|
||||||
input: GW_INPUT_STREAM
|
input: EWSGI_INPUT_STREAM
|
||||||
-- Server input channel
|
-- Server input channel
|
||||||
|
|
||||||
feature -- Status
|
feature -- Status
|
||||||
@@ -95,7 +95,7 @@ feature -- Error handling
|
|||||||
|
|
||||||
feature -- Access: environment variables
|
feature -- Access: environment variables
|
||||||
|
|
||||||
environment: GW_ENVIRONMENT
|
environment: EWSGI_ENVIRONMENT
|
||||||
-- Environment variables
|
-- Environment variables
|
||||||
|
|
||||||
environment_variable (a_name: STRING): detachable STRING
|
environment_variable (a_name: STRING): detachable STRING
|
||||||
@@ -202,7 +202,7 @@ feature -- Form fields and related
|
|||||||
Result := form_fields.variable (a_name)
|
Result := form_fields.variable (a_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
uploaded_files: HASH_TABLE [GW_UPLOADED_FILE_DATA, STRING]
|
uploaded_files: HASH_TABLE [EWSGI_UPLOADED_FILE_DATA, STRING]
|
||||||
-- Table of uploaded files information
|
-- Table of uploaded files information
|
||||||
--| name: original path from the user
|
--| name: original path from the user
|
||||||
--| type: content type
|
--| type: content type
|
||||||
@@ -248,7 +248,7 @@ feature -- Cookies
|
|||||||
Result := cookies_variables.item (a_name)
|
Result := cookies_variables.item (a_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
cookies: HASH_TABLE [GW_COOKIE, STRING]
|
cookies: HASH_TABLE [EWSGI_COOKIE, STRING]
|
||||||
-- Cookies Information
|
-- Cookies Information
|
||||||
local
|
local
|
||||||
i,j,p,n: INTEGER
|
i,j,p,n: INTEGER
|
||||||
@@ -257,7 +257,7 @@ feature -- Cookies
|
|||||||
do
|
do
|
||||||
l_cookies := internal_cookies
|
l_cookies := internal_cookies
|
||||||
if l_cookies = Void then
|
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)
|
create l_cookies.make (5)
|
||||||
from
|
from
|
||||||
n := s.count
|
n := s.count
|
||||||
@@ -280,7 +280,7 @@ feature -- Cookies
|
|||||||
v := s.substring (i + 1, j - 1)
|
v := s.substring (i + 1, j - 1)
|
||||||
p := j + 1
|
p := j + 1
|
||||||
end
|
end
|
||||||
l_cookies.put (create {GW_COOKIE}.make (k,v), k)
|
l_cookies.put (create {EWSGI_COOKIE}.make (k,v), k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -385,7 +385,7 @@ feature -- Access extra information
|
|||||||
-- Request time (UTC)
|
-- Request time (UTC)
|
||||||
do
|
do
|
||||||
if
|
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
|
t.is_integer_64
|
||||||
then
|
then
|
||||||
Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64)
|
Result := date_time_utilities.unix_time_stamp_to_date_time (t.to_integer_64)
|
||||||
@@ -466,7 +466,7 @@ feature -- Element change
|
|||||||
error_handler := ehdl
|
error_handler := ehdl
|
||||||
end
|
end
|
||||||
|
|
||||||
update_path_info (env: GW_ENVIRONMENT)
|
update_path_info (env: EWSGI_ENVIRONMENT)
|
||||||
-- Fix and update PATH_INFO value if needed
|
-- Fix and update PATH_INFO value if needed
|
||||||
local
|
local
|
||||||
l_path_info: STRING
|
l_path_info: STRING
|
||||||
@@ -513,7 +513,7 @@ feature -- Uploaded File Handling
|
|||||||
|
|
||||||
feature {NONE} -- Temporary 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'
|
-- Delete file `a_filename'
|
||||||
require
|
require
|
||||||
uf_valid: uf /= Void
|
uf_valid: uf /= Void
|
||||||
@@ -536,7 +536,7 @@ feature {NONE} -- Temporary File handling
|
|||||||
end
|
end
|
||||||
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'
|
-- Save uploaded file content to `a_filename'
|
||||||
local
|
local
|
||||||
bn: STRING
|
bn: STRING
|
||||||
@@ -703,7 +703,7 @@ feature {NONE} -- Implementation: Form analyzer
|
|||||||
l_header: detachable STRING
|
l_header: detachable STRING
|
||||||
l_content: detachable STRING
|
l_content: detachable STRING
|
||||||
l_line: detachable STRING
|
l_line: detachable STRING
|
||||||
l_up_file_info: GW_UPLOADED_FILE_DATA
|
l_up_file_info: EWSGI_UPLOADED_FILE_DATA
|
||||||
do
|
do
|
||||||
from
|
from
|
||||||
p := 1
|
p := 1
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ class
|
|||||||
GW_IN_MEMORY_RESPONSE
|
GW_IN_MEMORY_RESPONSE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_RESPONSE
|
EWSGI_RESPONSE
|
||||||
redefine
|
redefine
|
||||||
commit
|
commit
|
||||||
end
|
end
|
||||||
|
|
||||||
create {GW_APPLICATION}
|
create {EWSGI_APPLICATION}
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
@@ -104,9 +104,9 @@ feature -- Header output operation
|
|||||||
header := h
|
header := h
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {GW_APPLICATION} -- Commit
|
feature {EWSGI_APPLICATION} -- Commit
|
||||||
|
|
||||||
commit (a_output: GW_OUTPUT_STREAM)
|
commit (a_output: EWSGI_OUTPUT_STREAM)
|
||||||
do
|
do
|
||||||
a_output.put_status_line (status_code)
|
a_output.put_status_line (status_code)
|
||||||
a_output.put_string (header.string)
|
a_output.put_string (header.string)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ deferred class
|
|||||||
GW_IN_MEMORY_RESPONSE_APPLICATION
|
GW_IN_MEMORY_RESPONSE_APPLICATION
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_APPLICATION
|
EWSGI_APPLICATION
|
||||||
redefine
|
redefine
|
||||||
process
|
process
|
||||||
end
|
end
|
||||||
@@ -20,7 +20,7 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Execution
|
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'
|
-- Process request with environment `env', and i/o streams `a_input' and `a_output'
|
||||||
do
|
do
|
||||||
request_count := request_count + 1
|
request_count := request_count + 1
|
||||||
@@ -29,13 +29,13 @@ feature -- Execution
|
|||||||
|
|
||||||
feature -- Factory
|
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
|
do
|
||||||
create {GW_REQUEST_IMP} Result.make (env, a_input)
|
create {GW_REQUEST_IMP} Result.make (env, a_input)
|
||||||
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
|
Result.execution_variables.set_variable (request_count.out, "REQUEST_COUNT")
|
||||||
end
|
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
|
do
|
||||||
create {GW_IN_MEMORY_RESPONSE} Result.make
|
create {GW_IN_MEMORY_RESPONSE} Result.make
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {EWSGI_ENVIRONMENT_VARIABLES}."
|
description: "Summary description for {GW_ENVIRONMENT_VARIABLES}."
|
||||||
legal: "See notice at end of class."
|
legal: "See notice at end of class."
|
||||||
status: "See notice at end of class."
|
status: "See notice at end of class."
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
EWSGI_ENVIRONMENT_VARIABLES
|
GW_ENVIRONMENT_VARIABLES
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
EWSGI_ENVIRONMENT
|
EWSGI_ENVIRONMENT
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {EWSGI_EXECUTION_VARIABLES}."
|
description: "Summary description for {GW_EXECUTION_VARIABLES}."
|
||||||
legal: "See notice at end of class."
|
legal: "See notice at end of class."
|
||||||
status: "See notice at end of class."
|
status: "See notice at end of class."
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
EWSGI_EXECUTION_VARIABLES
|
GW_EXECUTION_VARIABLES
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
EWSGI_VARIABLES [STRING_32]
|
EWSGI_VARIABLES [STRING_32]
|
||||||
@@ -8,13 +8,11 @@ note
|
|||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
EWSGI_REQUEST_VARIABLES
|
GW_REQUEST_VARIABLES
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
EWSGI_VARIABLES [STRING_32]
|
EWSGI_VARIABLES [STRING_32]
|
||||||
|
|
||||||
ITERABLE [STRING_32]
|
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_from_urlencoded
|
make_from_urlencoded
|
||||||
@@ -8,9 +8,9 @@ class
|
|||||||
GW_BUFFERED_RESPONSE
|
GW_BUFFERED_RESPONSE
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_RESPONSE
|
EWSGI_RESPONSE
|
||||||
|
|
||||||
create {GW_APPLICATION}
|
create {EWSGI_APPLICATION}
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
|
|||||||
create buffer.make (a_buffer_size)
|
create buffer.make (a_buffer_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
output: GW_OUTPUT_STREAM
|
output: EWSGI_OUTPUT_STREAM
|
||||||
|
|
||||||
buffer: STRING_8
|
buffer: STRING_8
|
||||||
|
|
||||||
@@ -143,9 +143,9 @@ feature {NONE} -- Implementation
|
|||||||
buffer_flushed: buffer_count = 0 and buffer.count = 0
|
buffer_flushed: buffer_count = 0 and buffer.count = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {GW_APPLICATION} -- Commit
|
feature {EWSGI_APPLICATION} -- Commit
|
||||||
|
|
||||||
commit (a_output: GW_OUTPUT_STREAM)
|
commit (a_output: EWSGI_OUTPUT_STREAM)
|
||||||
do
|
do
|
||||||
flush_buffer
|
flush_buffer
|
||||||
a_output.flush
|
a_output.flush
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ class
|
|||||||
GW_RESPONSE_IMP
|
GW_RESPONSE_IMP
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
GW_RESPONSE
|
EWSGI_RESPONSE
|
||||||
|
|
||||||
create {GW_APPLICATION}
|
create {EWSGI_APPLICATION}
|
||||||
make
|
make
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
@@ -20,9 +20,9 @@ feature {NONE} -- Initialization
|
|||||||
output := a_output
|
output := a_output
|
||||||
end
|
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
|
-- Commit the current response
|
||||||
do
|
do
|
||||||
a_output_stream.flush
|
a_output_stream.flush
|
||||||
@@ -94,7 +94,7 @@ feature -- Header output operation
|
|||||||
|
|
||||||
feature {NONE} -- Implementation: Access
|
feature {NONE} -- Implementation: Access
|
||||||
|
|
||||||
output: GW_OUTPUT_STREAM
|
output: EWSGI_OUTPUT_STREAM
|
||||||
-- Server output channel
|
-- Server output channel
|
||||||
|
|
||||||
;note
|
;note
|
||||||
|
|||||||
Reference in New Issue
Block a user