Added self doc to the wsf file system handler

Allow to hide the wsf file system handler from self documentation
Better description format handling for the self doc
This commit is contained in:
Jocelyn Fiat
2013-03-25 19:13:55 +01:00
parent da28baf872
commit 1ee6ffa725
3 changed files with 63 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ feature {NONE} -- Initialization
make (m: like mapping) make (m: like mapping)
do do
mapping := m mapping := m
create {STRING_32} description.make_empty create descriptions.make (0)
end end
feature -- Status report feature -- Status report
@@ -27,7 +27,7 @@ feature -- Status report
-- Is Current empty? -- Is Current empty?
-- i.e: does not carry any information. -- i.e: does not carry any information.
do do
Result := description.is_empty Result := descriptions.is_empty
end end
feature -- Access feature -- Access
@@ -35,7 +35,18 @@ feature -- Access
mapping: WSF_ROUTER_MAPPING mapping: WSF_ROUTER_MAPPING
-- Associated mapping -- Associated mapping
descriptions: ARRAYED_LIST [READABLE_STRING_GENERAL]
description: STRING_32 description: STRING_32
do
create Result.make_empty
across
descriptions as c
loop
Result.append_string_general (c.item)
Result.append ("%N")
end
end
feature -- Change feature -- Change
@@ -46,7 +57,17 @@ feature -- Change
add_description (d: READABLE_STRING_GENERAL) add_description (d: READABLE_STRING_GENERAL)
do do
description.append_string_general (d) descriptions.force (d)
end 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 end

View File

@@ -204,6 +204,7 @@ feature {WSF_RESPONSE} -- Output
l_url: detachable STRING_8 l_url: detachable STRING_8
l_base_url: detachable READABLE_STRING_8 l_base_url: detachable READABLE_STRING_8
l_doc: detachable WSF_ROUTER_MAPPING_DOCUMENTATION l_doc: detachable WSF_ROUTER_MAPPING_DOCUMENTATION
l_first: BOOLEAN
do do
if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} m as l_doc_mapping then if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} m as l_doc_mapping then
l_doc := l_doc_mapping.documentation (meths) l_doc := l_doc_mapping.documentation (meths)
@@ -256,7 +257,17 @@ feature {WSF_RESPONSE} -- Output
if l_doc /= Void and then not l_doc.is_empty then if l_doc /= Void and then not l_doc.is_empty then
s.append ("%N<ul class=%"handlerdoc%">") s.append ("%N<ul class=%"handlerdoc%">")
s.append (html_encoder.encoded_string (l_doc.description)) l_first := True
across
l_doc.descriptions as c
loop
if not l_first then
s.append ("<br/>")
else
l_first := False
end
s.append (html_encoder.general_encoded_string (c.item))
end
s.append ("%N</ul>%N") s.append ("%N</ul>%N")
else else
debug debug

View File

@@ -13,8 +13,11 @@ inherit
execute as execute_starts_with execute as execute_starts_with
end end
WSF_SELF_DOCUMENTED_HANDLER
create create
make make,
make_hidden
feature {NONE} -- Initialization feature {NONE} -- Initialization
@@ -34,6 +37,29 @@ feature {NONE} -- Initialization
not document_root.is_empty and then not document_root.ends_with (operating_environment.directory_separator.out) not document_root.is_empty and then not document_root.ends_with (operating_environment.directory_separator.out)
end end
make_hidden (d: like document_root)
require
valid_d: (d /= Void and then not d.is_empty) implies not d.ends_with (operating_environment.directory_separator.out)
do
make (d)
is_hidden := True
ensure
hidden: is_hidden
end
is_hidden: BOOLEAN
-- Current mapped handler should be hidden from self documentation
feature -- Documentation
mapping_documentation (m: WSF_ROUTER_MAPPING; a_request_methods: detachable WSF_REQUEST_METHODS): WSF_ROUTER_MAPPING_DOCUMENTATION
-- <Precursor>
do
create Result.make (m)
Result.set_is_hidden (is_hidden)
Result.add_description ("File service")
end
feature -- Access feature -- Access
document_root: STRING document_root: STRING