Response to comments from review "Contracts for non-Void-safe users (take 1)"

This commit is contained in:
Colin Adams
2013-03-14 14:17:03 +00:00
parent ca5619c6fc
commit 4ec2832375
3 changed files with 19 additions and 20 deletions

View File

@@ -50,7 +50,7 @@ feature -- Method Get
require
req_attached: req /= Void
res_attached: res /= Void
get_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_get)
get_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_get)
do
do_get (req, res)
end
@@ -74,7 +74,7 @@ feature -- Method Post
require
req_attached: req /= Void
res_attached: res /= Void
post_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_post)
post_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_post)
do
if req.is_chunked_input then
do_post (req, res)
@@ -107,7 +107,7 @@ feature-- Method Put
require
req_attached: req /= Void
res_attached: res /= Void
put_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_put)
put_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_put)
do
if req.is_chunked_input then
do_put (req, res)
@@ -132,7 +132,7 @@ feature -- Method DELETE
require
req_attached: req /= Void
res_attached: res /= Void
delete_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_delete)
delete_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_delete)
do
do_delete (req, res)
end
@@ -153,7 +153,7 @@ feature -- Method CONNECT
require
req_attached: req /= Void
res_attached: res /= Void
connect_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_connect)
connect_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_connect)
do
do_connect (req, res)
end
@@ -170,7 +170,7 @@ feature -- Method HEAD
require
req_attached: req /= Void
res_attached: res /= Void
head_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_head)
head_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_head)
do
do_head (req, res)
end
@@ -194,7 +194,7 @@ feature -- Method OPTIONS
require
req_attached: req /= Void
res_attached: res /= Void
options_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_options)
options_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_options)
do
do_options (req, res)
end
@@ -212,7 +212,7 @@ feature -- Method TRACE
require
req_attached: req /= Void
res_attached: res /= Void
trace_method: req.request_method.as_upper.same_string ({HTTP_REQUEST_METHODS}.method_trace)
trace_method: req.is_request_method ({HTTP_REQUEST_METHODS}.method_trace)
do
do_trace (req, res)
end
@@ -260,13 +260,6 @@ feature -- Handle responses
-- The option : Server-driven negotiation: uses request headers to select a variant
-- More info : http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12
-- supported_content_types: detachable ARRAY [READABLE_STRING_8]
-- -- Supported content types
-- -- Can be redefined
-- do
-- Result := Void
-- end
-- TODO: review HTTP requirements on `a_description' for each individual error code.
handle_error (a_description: STRING; a_status_code: INTEGER; req: WSF_REQUEST; res: WSF_RESPONSE)

View File

@@ -55,7 +55,7 @@ feature {NONE} -- Initialization
end
make (n: INTEGER)
-- Initialize with space for `n' methods.
-- Initialize with capacity for `n' methods.
require
valid_number_of_items: n >= 0
do
@@ -65,7 +65,7 @@ feature {NONE} -- Initialization
make_from_iterable (v: ITERABLE [READABLE_STRING_8])
-- Initialize for all methods named by `v'.
require
v_attached: v /= Void
v_all_methods_attached: v /= Void and then True -- Can this be specified using across? It's annoying that ITERABLE doesn't have for_all.
do
make (1)
add_methods (v)
@@ -427,7 +427,9 @@ feature {WSF_REQUEST_METHODS} -- Implementation
across
lst as c
loop
add_method_using_constant (c.item)
if not c.item.is_empty and not has (c.item) then
add_method_using_constant (c.item)
end
end
end
end
@@ -438,6 +440,8 @@ feature {NONE} -- Implementation
-- Add method `v' using method_* constant.
require
v_attached: v /= Void
v_not_empty: not v.is_empty
new_method: not has (v)
do
if v.is_case_insensitive_equal (method_get) then
enable_get

View File

@@ -134,7 +134,8 @@ feature -- Basic operations
dispatch_and_return_handler (req: WSF_REQUEST; res: WSF_RESPONSE): detachable WSF_HANDLER
-- Dispatch request `req' among the `mappings'
-- And return the associated handler (violating CQS) if mapping found and handler executed.
-- And return the associated handler if mapping found and handler executed.
--| Violates CQS
require
req_attached: req /= Void
res_attached: res /= Void
@@ -157,7 +158,8 @@ feature {NONE} -- Dispatch implementation
dispatch_and_return_handler_for_request_method (req: WSF_REQUEST; res: WSF_RESPONSE; a_request_method: READABLE_STRING_8): detachable WSF_HANDLER
-- Dispatch request `req' among the `mappings'
-- And return the associated handler (violating CQS) if mapping found and handler executed.
-- And return the associated handler if mapping found and handler executed.
--| Violates CQS
require
req_attached: req /= Void
res_attached: res /= Void