Use class URI
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -26,10 +26,11 @@ feature -- Access
|
||||
do
|
||||
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
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@ note
|
||||
The default policy implemented here is to require
|
||||
use of the proxy for HTTP/1.0 clients (only) for all requests.
|
||||
]"
|
||||
|
||||
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -25,16 +25,18 @@ feature -- Access
|
||||
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
|
||||
--| 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
|
||||
req_attached: req /= Void
|
||||
proxy_required: requires_proxy (req)
|
||||
deferred
|
||||
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
|
||||
|
||||
is_http_1_0 (req: WSF_REQUEST): BOOLEAN
|
||||
@@ -73,4 +75,14 @@ feature -- Access
|
||||
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
|
||||
|
||||
@@ -251,7 +251,7 @@ feature {NONE} -- Implementation
|
||||
create h.make
|
||||
h.put_content_type_text_plain
|
||||
h.put_current_date
|
||||
h.put_location (proxy_server (req))
|
||||
h.put_location (proxy_server (req).string)
|
||||
h.put_content_length (0)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.use_proxy)
|
||||
ensure
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
<library name="error" location="../../utility/general/error/error-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="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="router" location=".\router" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
<library name="error" location="../../utility/general/error/error.ecf"/>
|
||||
<library name="http" location="../../network/protocol/http/http.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="router" location=".\router" recursive="true"/>
|
||||
</target>
|
||||
|
||||
Reference in New Issue
Block a user