Fifth round of contracts for non-Void-safe users
This commit is contained in:
@@ -24,7 +24,12 @@ inherit
|
|||||||
|
|
||||||
WSF_METHOD_HANDLER
|
WSF_METHOD_HANDLER
|
||||||
rename
|
rename
|
||||||
do_method as do_put
|
do_method as do_post
|
||||||
|
end
|
||||||
|
|
||||||
|
WSF_METHOD_HANDLER
|
||||||
|
rename
|
||||||
|
do_method as do_delete
|
||||||
end
|
end
|
||||||
|
|
||||||
WSF_METHOD_HANDLER
|
WSF_METHOD_HANDLER
|
||||||
|
|||||||
@@ -15,12 +15,19 @@ inherit
|
|||||||
feature -- Execution
|
feature -- Execution
|
||||||
|
|
||||||
execute (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
|
-- Handle `req' responding into `res'.
|
||||||
|
require
|
||||||
|
a_start_path_attached: a_start_path /= Void
|
||||||
|
req_attached: req /= Void
|
||||||
|
res_attached: res /= Void
|
||||||
|
path_start_with_a_start_path: req.path_info.starts_with (a_start_path)
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WSF_ROUTER} -- Mapping
|
feature {WSF_ROUTER} -- Mapping
|
||||||
|
|
||||||
new_mapping (a_uri: READABLE_STRING_8): WSF_ROUTER_MAPPING
|
new_mapping (a_uri: READABLE_STRING_8): WSF_ROUTER_MAPPING
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
create {WSF_STARTS_WITH_MAPPING} Result.make (a_uri, Current)
|
create {WSF_STARTS_WITH_MAPPING} Result.make (a_uri, Current)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ feature -- Access
|
|||||||
feature -- Change
|
feature -- Change
|
||||||
|
|
||||||
set_handler (h: like handler)
|
set_handler (h: like handler)
|
||||||
|
-- Set `handler' to `h'.
|
||||||
|
require
|
||||||
|
h_attached: h /= Void
|
||||||
deferred
|
deferred
|
||||||
|
ensure
|
||||||
|
h_aliased: handler = h
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Documentation
|
feature -- Documentation
|
||||||
@@ -72,14 +77,23 @@ feature -- Status
|
|||||||
feature {NONE} -- Execution
|
feature {NONE} -- Execution
|
||||||
|
|
||||||
execute_handler (h: like handler; a_start_path: like uri; req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute_handler (h: like handler; a_start_path: like uri; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute handler `h' with `req' and `res' for Current mapping
|
-- Execute handler `h' with `req' and `res' for Current mapping.
|
||||||
|
require
|
||||||
|
h_attached: h /= Void
|
||||||
|
a_start_path_attached: a_start_path /= Void
|
||||||
|
req_attached: req /= Void
|
||||||
|
res_attached: res /= Void
|
||||||
|
path_start_with_a_start_path: req.path_info.starts_with (a_start_path)
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
based_uri (a_uri: like uri; a_router: WSF_ROUTER): like uri
|
based_uri (a_uri: like uri; a_router: WSF_ROUTER): like uri
|
||||||
-- `uri' prefixed by the `WSF_ROUTER.base_url' if any
|
-- `a_uri' prefixed by the `WSF_ROUTER.base_url' if any
|
||||||
|
require
|
||||||
|
a_uri_attached: a_uri /= Void
|
||||||
|
a_router_attached: a_router /= Void
|
||||||
local
|
local
|
||||||
s: STRING_8
|
s: STRING_8
|
||||||
do
|
do
|
||||||
@@ -90,8 +104,14 @@ feature {NONE} -- Implementation
|
|||||||
else
|
else
|
||||||
Result := a_uri
|
Result := a_uri
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
based_uri_attached: Result /= Void
|
||||||
end
|
end
|
||||||
|
|
||||||
|
invariant
|
||||||
|
|
||||||
|
uri_attached: uri /= Void
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
Reference in New Issue
Block a user