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 d583dd6e..a39b7180 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 @@ -18,26 +18,49 @@ create feature {NONE} -- Initialization make (req: WSF_REQUEST; a_router: WSF_ROUTER; a_resource: detachable STRING) - local - do request := req router := a_router - if attached a_router.base_url as l_base_url then - resource := l_base_url.twin - else - create resource.make_empty - end - if a_resource /= Void then - resource.append (a_resource) + if a_resource /= Void and then attached a_router.base_url as l_base_url then + resource := l_base_url + a_resource end end +feature -- Access + request: WSF_REQUEST router: WSF_ROUTER - resource: STRING_8 + resource: detachable STRING_8 + +feature -- Properties + + header: detachable STRING_8 + -- Header's content for the output HTML. + + footer: detachable STRING_8 + -- Footer's content for the output HTML. + + custom_style_url: detachable STRING_8 + -- URL for a custom style css document. + +feature -- Change + + set_header (v: like header) + do + header := v + end + + set_footer (v: like footer) + do + footer := v + end + + set_custom_style_url (v: like custom_style_url) + do + custom_style_url := v + end feature {WSF_RESPONSE} -- Output @@ -58,16 +81,23 @@ feature {WSF_RESPONSE} -- Output l_description.append ("") l_description.append ("
") l_description.append ("")
- s.append ("")
- s.append (m.associated_resource)
- s.append ("")
+ if doc_url_supported then
+ s.append ("")
+ s.append (m.associated_resource)
+ s.append ("")
+ else
+ s.append (m.associated_resource)
+ end
+ s.append ("")
if attached {WSF_SELF_DOCUMENTED_ROUTER_MAPPING} m as l_doc_mapping then
s.append (" " + html_encoder.encoded_string (l_doc_mapping.documentation) + " ")
@@ -198,9 +240,24 @@ feature {WSF_RESPONSE} -- Output
feature {NONE} -- Implementation
- doc_url (a_api: STRING_8): STRING_8
+ doc_url_supported: BOOLEAN
+ -- Is `doc_url' supported?
do
- Result := request.script_url (resource + url_encoder.encoded_string (a_api))
+ Result := resource /= Void
+ end
+
+ doc_url (a_api: STRING_8): STRING_8
+ -- URL to show the documentation related to `a_api'.
+ require
+ doc_url_supported: doc_url_supported
+ do
+ if attached resource as s then
+ Result := request.script_url (s + url_encoder.encoded_string (a_api))
+ elseif attached router.base_url as l_base_url then
+ Result := request.script_url (l_base_url + url_encoder.encoded_string (a_api))
+ else
+ Result := request.script_url (a_api)
+ end
end
html_encoder: HTML_ENCODER