From 1ee6ffa72505142808d0786a33fdfd9bd90c4a87 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 25 Mar 2013 19:13:55 +0100 Subject: [PATCH] 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 --- .../wsf_router_mapping_documentation.e | 27 ++++++++++++++++-- .../wsf_router_self_documentation_message.e | 13 ++++++++- .../wsf/router/wsf_file_system_handler.e | 28 ++++++++++++++++++- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/library/server/wsf/router/documentation/wsf_router_mapping_documentation.e b/library/server/wsf/router/documentation/wsf_router_mapping_documentation.e index ea334357..5f755f35 100644 --- a/library/server/wsf/router/documentation/wsf_router_mapping_documentation.e +++ b/library/server/wsf/router/documentation/wsf_router_mapping_documentation.e @@ -14,7 +14,7 @@ feature {NONE} -- Initialization make (m: like mapping) do mapping := m - create {STRING_32} description.make_empty + create descriptions.make (0) end feature -- Status report @@ -27,7 +27,7 @@ feature -- Status report -- Is Current empty? -- i.e: does not carry any information. do - Result := description.is_empty + Result := descriptions.is_empty end feature -- Access @@ -35,7 +35,18 @@ feature -- Access mapping: WSF_ROUTER_MAPPING -- Associated mapping + descriptions: ARRAYED_LIST [READABLE_STRING_GENERAL] + 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 @@ -46,7 +57,17 @@ feature -- Change add_description (d: READABLE_STRING_GENERAL) do - description.append_string_general (d) + descriptions.force (d) 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 diff --git a/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e b/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e index 6aea58be..21d4bfc4 100644 --- a/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e +++ b/library/server/wsf/router/documentation/wsf_router_self_documentation_message.e @@ -204,6 +204,7 @@ feature {WSF_RESPONSE} -- Output l_url: detachable STRING_8 l_base_url: detachable READABLE_STRING_8 l_doc: detachable WSF_ROUTER_MAPPING_DOCUMENTATION + l_first: BOOLEAN do if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} m as l_doc_mapping then 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 s.append ("%N%N") else debug diff --git a/library/server/wsf/router/wsf_file_system_handler.e b/library/server/wsf/router/wsf_file_system_handler.e index 628115bf..9e54a43e 100644 --- a/library/server/wsf/router/wsf_file_system_handler.e +++ b/library/server/wsf/router/wsf_file_system_handler.e @@ -13,8 +13,11 @@ inherit execute as execute_starts_with end + WSF_SELF_DOCUMENTED_HANDLER + create - make + make, + make_hidden 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) 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 + -- + do + create Result.make (m) + Result.set_is_hidden (is_hidden) + Result.add_description ("File service") + end + feature -- Access document_root: STRING