Use class URI

This commit is contained in:
Colin Adams
2013-03-26 16:10:32 +00:00
parent ad5ccd6585
commit 14088f126b
8 changed files with 39 additions and 117 deletions

View File

@@ -1,28 +0,0 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_ROUTED_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class WSF_URI_TEMPLATE_ROUTED_SERVICE
obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_ROUTER_HELPER [2013-mar-19]"
inherit
WSF_ROUTED_SERVICE
WSF_URI_TEMPLATE_ROUTER_HELPER
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

@@ -1,66 +0,0 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_ROUTER_HELPER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_ROUTER_HELPER
feature -- Access
router: WSF_ROUTER
deferred
end
feature -- Mapping helper: uri
map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER)
-- Map `h' as handler for `a_tpl'
require
a_tpl_attached: a_tpl /= Void
h_attached: h /= Void
do
map_uri_template_with_request_methods (a_tpl, h, Void)
end
map_uri_template_with_request_methods (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
-- Map `h' as handler for `a_tpl' for request methods `rqst_methods'.
require
a_tpl_attached: a_tpl /= Void
h_attached: h /= Void
do
router.map_with_request_methods (create {WSF_URI_TEMPLATE_MAPPING}.make (a_tpl, h), rqst_methods)
end
feature -- Mapping helper: uri agent
map_uri_template_agent (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
-- Map `proc' as handler for `a_tpl'
require
a_tpl_attached: a_tpl /= Void
proc_attached: proc /= Void
do
map_uri_template_agent_with_request_methods (a_tpl, proc, Void)
end
map_uri_template_agent_with_request_methods (a_tpl: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_REQUEST_METHODS)
-- Map `proc' as handler for `a_tpl' for request methods `rqst_methods'.
require
a_tpl_attached: a_tpl /= Void
proc_attached: proc /= Void
do
map_uri_template_with_request_methods (a_tpl, create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (proc), rqst_methods)
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

@@ -26,10 +26,11 @@ feature -- Access
do do
end end
proxy_server (req: WSF_REQUEST): READABLE_STRING_8 -- We can't currently use UT_URI proxy_server (req: WSF_REQUEST): URI
-- Absolute URI of proxy server which `req' must use -- Absolute URI of proxy server which `req' must use
do do
Result := "" -- doesn't meet the postcondition, but the precondition is never true. create Result.make_from_string ("")
-- doesn't meet the postcondition, but the precondition is never true.
end end
end end

View File

@@ -25,16 +25,18 @@ feature -- Access
end end
end end
proxy_server (req: WSF_REQUEST): READABLE_STRING_8 -- We can't currently use UT_URI proxy_server (req: WSF_REQUEST): URI
-- Absolute URI of proxy server which `req' must use -- Absolute URI of proxy server which `req' must use
--| An alternative design would allow a relative URI (relative to the server host),
--| which will only work if both the server and the proxy use the default ports.
require require
req_attached: req /= Void req_attached: req /= Void
proxy_required: requires_proxy (req) proxy_required: requires_proxy (req)
deferred deferred
ensure ensure
absolute_uri: True -- We can't currently use UT_URI to check this. Have we got another class? proxy_server_attached: Result /= Void
valid_uri: Result.is_valid
absolute_uri: not Result.scheme.is_empty
http_or_https: Result.scheme.is_case_insensitive_equal ("http") or
Result.scheme.is_case_insensitive_equal ("https")
end end
is_http_1_0 (req: WSF_REQUEST): BOOLEAN is_http_1_0 (req: WSF_REQUEST): BOOLEAN
@@ -73,4 +75,14 @@ feature -- Access
end end
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

@@ -251,7 +251,7 @@ feature {NONE} -- Implementation
create h.make create h.make
h.put_content_type_text_plain h.put_content_type_text_plain
h.put_current_date h.put_current_date
h.put_location (proxy_server (req)) h.put_location (proxy_server (req).string)
h.put_content_length (0) h.put_content_length (0)
res.set_status_code ({HTTP_STATUS_CODE}.use_proxy) res.set_status_code ({HTTP_STATUS_CODE}.use_proxy)
ensure ensure

View File

@@ -16,7 +16,9 @@
<library name="error" location="../../utility/general/error/error-safe.ecf"/> <library name="error" location="../../utility/general/error/error-safe.ecf"/>
<library name="http" location="../../network/protocol/http/http-safe.ecf"/> <library name="http" location="../../network/protocol/http/http-safe.ecf"/>
<library name="uri_template" location="../../text/parser/uri_template/uri_template-safe.ecf"/> <library name="uri_template" location="../../text/parser/uri_template/uri_template-safe.ecf"/>
<library name="encoder" location="..\..\text\encoder\encoder-safe.ecf"/> <library name="encoder"
location="..\..\text\encoder\encoder-safe.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri-safe.ecf" readonly="true"/>
<cluster name="src" location=".\src" recursive="true"/> <cluster name="src" location=".\src" recursive="true"/>
<cluster name="router" location=".\router" recursive="true"/> <cluster name="router" location=".\router" recursive="true"/>
</target> </target>

View File

@@ -16,7 +16,9 @@
<library name="error" location="../../utility/general/error/error.ecf"/> <library name="error" location="../../utility/general/error/error.ecf"/>
<library name="http" location="../../network/protocol/http/http.ecf"/> <library name="http" location="../../network/protocol/http/http.ecf"/>
<library name="uri_template" location="../../text/parser/uri_template/uri_template.ecf"/> <library name="uri_template" location="../../text/parser/uri_template/uri_template.ecf"/>
<library name="encoder" location="..\..\text\encoder\encoder.ecf"/> <library name="encoder"
location="..\..\text\encoder\encoder.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf" readonly="true"/>
<cluster name="src" location=".\src" recursive="true"/> <cluster name="src" location=".\src" recursive="true"/>
<cluster name="router" location=".\router" recursive="true"/> <cluster name="router" location=".\router" recursive="true"/>
</target> </target>

View File

@@ -11,33 +11,33 @@
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard"> <option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
</option> </option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\draft\application\cms\cms-safe.ecf" readonly="false"/>
<library name="connector_cgi" location="..\library\server\ewsgi\connectors\cgi\cgi-safe.ecf" readonly="false"/> <library name="connector_cgi" location="..\library\server\ewsgi\connectors\cgi\cgi-safe.ecf" readonly="false"/>
<library name="connector_libfcgi" location="..\library\server\ewsgi\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/> <library name="connector_libfcgi" location="..\library\server\ewsgi\connectors\libfcgi\libfcgi-safe.ecf" readonly="false"/>
<library name="connector_nino" location="..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/> <library name="connector_nino" location="..\library\server\ewsgi\connectors\nino\nino-safe.ecf" readonly="false"/>
<library name="connector_null" location="..\library\server\ewsgi\connectors\null\null-safe.ecf" readonly="false"/> <library name="connector_null" location="..\library\server\ewsgi\connectors\null\null-safe.ecf" readonly="false"/>
<library name="encoder" location="..\library\text\encoder\encoder-safe.ecf" readonly="false"/> <library name="conneg" location="..\library\network\protocol\CONNEG\conneg-safe.ecf" readonly="false"/>
<library name="wsf_connector_nino" location="..\library\server\wsf\connector\nino-safe.ecf" readonly="false"/> <library name="css" location="..\draft\library\text\css\css-safe.ecf" readonly="false"/>
<library name="wsf_connector_openshift" location="..\library\server\wsf\connector\openshift-safe.ecf" readonly="false"/>
<library name="dft_connector_libfcgi" location="..\library\server\wsf\default\libfcgi-safe.ecf" readonly="false"/>
<library name="dft_connector_cgi" location="..\library\server\wsf\default\cgi-safe.ecf" readonly="false"/> <library name="dft_connector_cgi" location="..\library\server\wsf\default\cgi-safe.ecf" readonly="false"/>
<library name="dft_connector_libfcgi" location="..\library\server\wsf\default\libfcgi-safe.ecf" readonly="false"/>
<library name="dft_connector_nino" location="..\library\server\wsf\default\nino-safe.ecf" readonly="false"/> <library name="dft_connector_nino" location="..\library\server\wsf\default\nino-safe.ecf" readonly="false"/>
<library name="dft_connector_openshift" location="..\library\server\wsf\default\openshift-safe.ecf" readonly="false"/> <library name="dft_connector_openshift" location="..\library\server\wsf\default\openshift-safe.ecf" readonly="false"/>
<library name="conneg" location="../library/network/protocol/CONNEG/conneg-safe.ecf" readonly="false"/> <library name="encoder" location="..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="ewf_support" location="..\library\server\ewf_support\ewf_support-safe.ecf" readonly="false"/>
<library name="ewsgi" location="..\library\server\ewsgi\ewsgi-safe.ecf" readonly="false"/> <library name="ewsgi" location="..\library\server\ewsgi\ewsgi-safe.ecf" readonly="false"/>
<library name="ex_filter" location="..\examples\filter\filter-safe.ecf" readonly="false"/>
<library name="ex_restbuck" location="..\examples\restbucksCRUD\restbucks-safe.ecf" readonly="false"/>
<library name="ex_simple" location="..\examples\simple\simple.ecf" readonly="false"/>
<library name="http" location="..\library\network\protocol\http\http-safe.ecf" readonly="false"/> <library name="http" location="..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
<library name="http_authorization" location="..\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/> <library name="http_authorization" location="..\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<library name="http_client" location="..\library\network\http_client\http_client-safe.ecf" readonly="false"/> <library name="http_client" location="..\library\network\http_client\http_client-safe.ecf" readonly="false"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/> <library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="wsf" location="..\library\server\wsf\wsf-safe.ecf" readonly="false"/> <library name="wsf" location="..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
<library name="ewf_support" location="..\library\server\ewf_support\ewf_support-safe.ecf" readonly="false"/> <library name="wsf_connector_nino" location="..\library\server\wsf\connector\nino-safe.ecf" readonly="false"/>
<library name="wsf_connector_openshift" location="..\library\server\wsf\connector\openshift-safe.ecf" readonly="false"/>
<library name="wsf_extension" location="..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/> <library name="wsf_extension" location="..\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf_session" location="..\library\server\wsf\wsf_session-safe.ecf" readonly="false"/>
<library name="wsf_router_context" location="..\library\server\wsf\wsf_router_context-safe.ecf" readonly="false"/> <library name="wsf_router_context" location="..\library\server\wsf\wsf_router_context-safe.ecf" readonly="false"/>
<library name="ex_restbuck" location="..\examples\restbucksCRUD\restbucks-safe.ecf" readonly="false"/> <library name="wsf_session" location="..\library\server\wsf\wsf_session-safe.ecf" readonly="false"/>
<library name="ex_simple" location="..\examples\simple\simple.ecf" readonly="false"/>
<library name="ex_filter" location="..\examples\filter\filter-safe.ecf" readonly="false"/>
<library name="cms" location="..\draft\application\cms\cms-safe.ecf" readonly="false"/>
<library name="css" location="..\draft\library\text\css\css-safe.ecf" readonly="false"/>
</target> </target>
<target name="all_windows" extends="all"> <target name="all_windows" extends="all">
<description>Compiling as Windows , on other platforms than Windows</description> <description>Compiling as Windows , on other platforms than Windows</description>
@@ -49,5 +49,4 @@
<root all_classes="true"/> <root all_classes="true"/>
<setting name="platform" value="unix"/> <setting name="platform" value="unix"/>
</target> </target>
</system> </system>