Fixed self documentation when querying documentation related to a specific resource (uri, uri-template, ..)

Before it was showing only the first found
so if we had
  "/foo" GET -> FOO_GET_HANDLER
  "/foo" POST -> FOO_POST_HANDLER
It was showing only the first, now this is working as expected.
This commit is contained in:
Jocelyn Fiat
2013-03-22 15:10:26 +01:00
parent a4095b4e16
commit eca868f10f
3 changed files with 64 additions and 6 deletions

View File

@@ -158,10 +158,18 @@ feature {WSF_RESPONSE} -- Output
if doc_url_supported then
l_description.append ("<a href=%""+ doc_url ("") + "%">Index</a><br/>")
end
if attached router.item_associated_with_resource (l_api_resource, Void) as l_api_item then
l_description.append ("<h2>Information related to <code>" + l_api_resource + "</code></h2><ul class=%"mapping%">")
append_documentation_to (l_description, l_api_item.mapping, l_api_item.request_methods)
l_description.append ("</ul>")
if
attached router.items_associated_with_resource (l_api_resource, Void) as l_api_items and then
not l_api_items.is_empty
then
l_description.append ("<h2>Information related to <code>" + l_api_resource + "</code></h2>")
across
l_api_items as c
loop
l_description.append ("<ul class=%"mapping%">")
append_documentation_to (l_description, c.item.mapping, c.item.request_methods)
l_description.append ("</ul>")
end
end
else
l_description.append ("<h2>Router</h2><ul class=%"mapping%">")
@@ -304,4 +312,14 @@ feature {NONE} -- Implementation
create Result
end
note
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)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -14,10 +14,19 @@ feature -- Documentation
--| `m' and `a_request_methods' are useful to produce specific documentation when the handler is used for multiple mapping.
require
m_attached: m /= Void
a_request_methods_attached: a_request_methods /= Void
deferred
ensure
mapping_documentation_attached: Result /= Void
end
note
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)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end