Merged REQUEST and ENVIRONMENT into REQUEST

renamed ENVIRONMENT_NAMES into META_NAMES
better usage of READABLE_STRING_GENERAL, and other strings
abstract RESPONSE_BUFFER in implementation of EWSGI
for the implementation, inheriting from deferred specification (more to come later)
This commit is contained in:
Jocelyn Fiat
2011-08-25 14:41:35 +02:00
parent 4d0148d562
commit f6b362217c
34 changed files with 1275 additions and 2366 deletions

View File

@@ -28,9 +28,9 @@ feature -- Access
s: detachable STRING
i,n: INTEGER
do
Result := request.environment.content_type
Result := request.content_type
if Result = Void then
s := request.environment.http_accept
s := request.http_accept
if s /= Void then
if attached accepted_content_types (request) as l_accept_lst then
from
@@ -61,18 +61,18 @@ feature -- Access
feature -- Query
path_parameter (a_name: STRING): detachable STRING_32
path_parameter (a_name: STRING): detachable READABLE_STRING_32
-- Parameter value for path variable `a_name'
deferred
end
query_parameter (a_name: STRING): detachable STRING_32
query_parameter (a_name: STRING): detachable READABLE_STRING_32
-- Parameter value for query variable `a_name'
--| i.e after the ? character
deferred
end
parameter (a_name: STRING): detachable STRING_32
parameter (a_name: STRING): detachable READABLE_STRING_32
-- Any parameter value for variable `a_name'
-- URI template parameter and query parameters
do

View File

@@ -27,7 +27,7 @@ feature -- Query
do
end
query_parameter (a_name: STRING): detachable STRING_32
query_parameter (a_name: STRING): detachable READABLE_STRING_32
do
Result := request.parameter (a_name)
end

View File

@@ -31,12 +31,12 @@ feature -- Access
feature -- Query
path_parameter (a_name: STRING): detachable STRING_32
path_parameter (a_name: STRING): detachable READABLE_STRING_32
do
Result := uri_template_match.url_decoded_path_variable (a_name)
end
query_parameter (a_name: STRING): detachable STRING_32
query_parameter (a_name: STRING): detachable READABLE_STRING_32
do
Result := uri_template_match.url_decoded_query_variable (a_name)
if Result = Void then

View File

@@ -24,7 +24,7 @@ feature -- Status report
is_valid_context (req: EWSGI_REQUEST): BOOLEAN
-- Is `req' valid context for current handler?
do
Result := request_method_name_supported (req.environment.request_method)
Result := request_method_name_supported (req.request_method)
end
feature -- Execution
@@ -37,7 +37,7 @@ feature -- Execution
rescued: BOOLEAN
do
if not rescued then
if request_method_name_supported (req.environment.request_method) then
if request_method_name_supported (req.request_method) then
pre_execute (req)
execute_application (a_hdl_context, req, res)
post_execute (req, res)
@@ -165,12 +165,12 @@ feature -- Execution: report
s := args
if s /= Void and then s.count > 0 then
if s[1] /= '/' then
s := req.environment.request_uri + "/" + s
s := req.request_uri + "/" + s
else
s := req.environment.request_uri + s
s := req.request_uri + s
end
else
s := req.environment.request_uri
s := req.request_uri
end
if abs then
Result := req.absolute_script_url (s)

View File

@@ -63,10 +63,10 @@ feature {NONE} -- Access: Implementation
handler (req: EWSGI_REQUEST): detachable TUPLE [handler: REQUEST_HANDLER; context: REQUEST_HANDLER_CONTEXT]
-- Handler whose map matched with `req'
require
req_valid: req /= Void and then req.environment.path_info /= Void
req_valid: req /= Void and then req.path_info /= Void
deferred
ensure
req_path_info_unchanged: req.environment.path_info.same_string (old req.environment.path_info)
req_path_info_unchanged: req.path_info.same_string (old req.path_info)
end
feature {NONE} -- Implementation

View File

@@ -52,7 +52,7 @@ feature {NONE} -- Access: Implementation
t: STRING
p: STRING
do
p := req.environment.request_uri
p := req.request_uri
from
l_handlers := handlers
l_handlers.start
@@ -77,7 +77,7 @@ feature -- Context factory
if p /= Void then
create Result.make (req, tpl, tpl_res, p)
else
create Result.make (req, tpl, tpl_res, req.environment.path_info)
create Result.make (req, tpl, tpl_res, req.path_info)
end
end

View File

@@ -17,7 +17,7 @@ feature -- Access
lst: LIST [STRING]
qs: QUICK_SORTER [STRING]
do
l_accept := req.environment.http_accept
l_accept := req.http_accept
--TEST l_accept := "text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8"
if l_accept /= Void then