Further contracts for non-Void-safe users

This commit is contained in:
Colin Adams
2013-03-14 15:29:11 +00:00
parent a96a143fe0
commit 3206bcc4fd
3 changed files with 34 additions and 10 deletions

View File

@@ -15,6 +15,10 @@ inherit
feature -- Execution feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE) execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute handler for `req' and respond in `res'.
require
req_attached: req /= Void
res_attached: res /= Void
deferred deferred
end end
@@ -26,7 +30,7 @@ feature {WSF_ROUTER} -- Mapping
end end
note note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" copyright: "2011-2013, 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)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -421,7 +421,7 @@ feature {WSF_REQUEST_METHODS} -- Implementation
add_methods (lst: ITERABLE [READABLE_STRING_8]) add_methods (lst: ITERABLE [READABLE_STRING_8])
-- Enable methods from `lst'. -- Enable methods from `lst'.
require require
lst_attached: lst /= Void lst_all_attached: lst /= Void and then across lst as c all c.item /= Void end
do do
if not is_locked then if not is_locked then
across across

View File

@@ -13,27 +13,36 @@ inherit
feature {NONE} -- Initialization feature {NONE} -- Initialization
make (a_resource: READABLE_STRING_8; h: like handler) make (a_resource: READABLE_STRING_8; h: like handler)
-- Create mapping based on resource `a_resource' and handler `h' -- Create mapping based on resource `a_resource' and handler `h'.
require
a_resource_attached: a_resource /= Void
h_attached: h /= Void
deferred deferred
end end
feature -- Access feature -- Access
associated_resource: READABLE_STRING_8 associated_resource: READABLE_STRING_8
-- Associated resource -- URI of handled resource
deferred deferred
ensure
assciated_resource_not_void: Result /= Void
end end
handler: WSF_HANDLER handler: WSF_HANDLER
-- Handler associated with Current mapping. -- Handler associated with `Current' mapping
deferred deferred
ensure
handler_attached: Result /= Void
end end
feature -- Documentation feature -- Documentation
description: READABLE_STRING_32 description: READABLE_STRING_32
-- Short description of associated mapping. -- Short description of associated mapping
deferred deferred
ensure
description_attached: Result /= Void
end end
feature -- Status report feature -- Status report
@@ -47,25 +56,36 @@ feature -- Status report
feature -- Status feature -- Status
is_mapping (req: WSF_REQUEST; a_router: WSF_ROUTER): BOOLEAN is_mapping (req: WSF_REQUEST; a_router: WSF_ROUTER): BOOLEAN
-- Does Current accept `req'? -- Does `Current' accept `req' when using `a_router'?
require
req_attached: req /= Void
a_router_attached: a_router /= Void
deferred deferred
end end
routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
-- Return the handler if Current matches the request `req'. -- Handler when `Current' matches the request `req'
require
req_attached: req /= Void
res_attached: res /= Void
a_router_attached: a_router /= Void
deferred deferred
end end
feature -- Helper feature -- Helper
path_from_request (req: WSF_REQUEST): READABLE_STRING_32 path_from_request (req: WSF_REQUEST): READABLE_STRING_32
-- Path used by Current to check that Current mapping matches request `req'. -- Path used by `Current' to check that mapping matches request `req'
require
req_attached: req /= Void
do do
Result := req.path_info Result := req.path_info
ensure
path_from_request_attached: Result /= Void
end end
note note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" copyright: "2011-2013, 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)"
source: "[ source: "[
Eiffel Software Eiffel Software