Applied new ROUTER design to the whole EWF project.

This commit is contained in:
Jocelyn Fiat
2012-09-25 23:18:17 +02:00
parent 0503e63209
commit 28186efbe7
61 changed files with 960 additions and 1129 deletions

View File

@@ -1,327 +0,0 @@
note
description: "Summary description for {REST_API_DOCUMENTATION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_API_DOCUMENTATION [C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
REST_REQUEST_HANDLER [C]
create
make
feature {NONE} -- Initialization
make (a_router: like router; a_base_doc_url: like base_doc_url)
do
router := a_router
base_doc_url := a_base_doc_url
description := "Technical documention for the API"
end
feature {NONE} -- Access: Implementation
router: REST_REQUEST_ROUTER [REST_REQUEST_HANDLER [C], C]
base_doc_url: READABLE_STRING_8
feature -- Access
authentication_required (req: WSF_REQUEST): BOOLEAN
do
end
resource_value (ctx: C): detachable READABLE_STRING_32
do
if attached {WSF_STRING} ctx.item ("resource") as s then
Result := s.value
end
end
feature -- Execution
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
rep: like new_html_page
s: STRING
rq: detachable REST_REQUEST_HANDLER [C]
rq_resource: detachable READABLE_STRING_GENERAL
-- l_dft_format_name: detachable STRING
hdl_cursor: like router.new_cursor
do
rep := new_html_page
rep.headers.put_content_type_text_html
create s.make_empty
if
attached resource_value (ctx) as l_resource
then
from
hdl_cursor := router.new_cursor
until
hdl_cursor.after or rq /= Void
loop
if hdl_cursor.item.resource.same_string_general (l_resource) then
rq := hdl_cursor.item.handler
rq_resource := l_resource
end
hdl_cursor.forth
end
end
-- if a_args /= Void and then not a_args.is_empty then
-- rq := router.handler_by_path (a_args)
-- if rq = Void then
-- rq := handler_manager.smart_handler_by_path (a_args)
---- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
---- rq := grp.handlers.handler_by_path (a_args)
---- end
-- end
-- if
-- rq /= Void and then
-- attached rq.path_information (a_args) as l_info
-- then
-- l_dft_format_name := l_info.format
-- end
-- end
if rq /= Void and then rq_resource /= Void then
rep.set_big_title ("API: Technical documentation for ["+ rq_resource.as_string_8 +"]")
s.append_string ("<div class=%"api%">")
s.append_string ("<h2 class=%"api-name%" >")
s.append_string ("<a href=%"" + base_doc_url + "%">.. Show all features ..</a>")
s.append_string ("</h2></div>%N")
process_request_handler_doc (rq, rq_resource.as_string_8, s, ctx, req, res, Void)
else
rep.set_big_title ("API: Technical documentation")
from
hdl_cursor := router.new_cursor
until
hdl_cursor.after
loop
if attached hdl_cursor.item as l_item then
rq := l_item.handler
rep.add_shortcut (l_item.resource)
s.append ("<a name=%"" + rep.last_added_shortcut + "%"/>")
process_request_handler_doc (rq, l_item.resource, s, ctx, req, res, Void)
hdl_cursor.forth
end
end
end
rep.set_body (s)
rep.send (res)
rep.recycle
end
process_request_handler_doc (rq: REST_REQUEST_HANDLER [C]; a_resource: STRING; buf: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; a_dft_format: detachable STRING)
local
l_dft_format_name: detachable STRING
s: STRING
l_uri_tpl: URI_TEMPLATE
do
s := buf
if a_dft_format /= Void then
if rq.supported_format_names.has (a_dft_format) then
l_dft_format_name := a_dft_format
end
end
s.append_string ("<div class=%"api%">")
s.append_string ("<h2 class=%"api-name%" ><a href=%""+ url (req, base_doc_url, a_resource, False) +"%">"+ a_resource +"</a></h2>")
s.append_string ("<div class=%"inner%">")
-- if rq.hidden (req) then
-- s.append_string ("<div class=%"api-description%">This feature is hidden</div>%N")
-- else
if attached rq.description as desc then
s.append_string ("<div class=%"api-description%">" + desc + "</div>")
end
-- if attached {REST_REQUEST_GROUP_HANDLER} rq as grp then
-- s.append_string ("<div class=%"api-format%">Handler: <strong>")
-- if attached grp.handlers.new_cursor as l_handlers_cursor then
-- from
-- until
-- l_handlers_cursor.after
-- loop
-- s.append_string (" ")
-- s.append_string ("<a class=%"api-handler%" href=%"")
-- s.append_string (url (ctx, l_handlers_cursor.item.path, False))
-- s.append_string ("%">"+ l_handlers_cursor.item.path +"</a>")
-- l_handlers_cursor.forth
-- end
-- end
-- s.append_string ("</strong></div>")
-- end
if attached rq.supported_format_names as l_formats and then not l_formats.is_empty then
s.append_string ("<div class=%"api-format%">Supported formats: <strong>")
if attached l_formats.new_cursor as l_formats_cursor then
from
until
l_formats_cursor.after
loop
s.append_string (" ")
s.append_string ("<a class=%"api-name api-format")
if l_formats_cursor.item ~ l_dft_format_name then
s.append_string (" selected")
end
s.append_string ("%" href=%"" + url (req, base_doc_url, a_resource, False) + "." + l_formats_cursor.item + "%">"+ l_formats_cursor.item +"</a>")
l_formats_cursor.forth
end
end
s.append_string ("</strong></div>")
end
if attached rq.supported_request_method_names as l_methods and then not l_methods.is_empty then
s.append_string ("<div class=%"api-method%">Supported request methods: <strong>")
if attached l_methods.new_cursor as l_methods_cursor then
from
until
l_methods_cursor.after
loop
s.append_string (" ")
s.append_string (l_methods_cursor.item)
l_methods_cursor.forth
end
end
s.append_string ("</strong></div>")
end
s.append_string ("<div class=%"api-auth%">Authentication required: <strong>" + rq.authentication_required (req).out + "</strong></div>")
if attached {REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]} router as l_uri_template_router then
create l_uri_tpl.make (a_resource)
if attached l_uri_tpl.query_variable_names as l_query_variable_names and then not l_query_variable_names.is_empty then
s.append_string ("<div class=%"api-uri-template%">Query parameters: ")
-- s.append_string (rq.path)
from
l_query_variable_names.start
until
l_query_variable_names.after
loop
if l_query_variable_names.isfirst then
s.append_string ("?")
else
s.append_string ("&")
end
if attached l_query_variable_names.item as l_query_param then
s.append_string ("<strong>" + l_query_param + "</strong>")
s.append_string ("=<em>" + l_query_param + "</em>")
end
l_query_variable_names.forth
end
s.append_string ("</div>%N")
end
if attached l_uri_tpl.path_variable_names as l_path_variable_names and then not l_path_variable_names.is_empty then
s.append_string ("<div class=%"api-uri-template%">Path Segment parameters: ")
-- s.append_string (rq.path)
from
l_path_variable_names.start
until
l_path_variable_names.after
loop
if attached l_path_variable_names.item as l_seg_param then
s.append_string ("<em>{" + l_seg_param + "}</em>")
end
l_path_variable_names.forth
end
s.append_string ("</div>%N")
end
end
-- if attached rq._parameters as l_uri_params and then not l_uri_params.is_empty then
-- s.append_string ("<div class=%"api-uri-template%">URI Template: ")
-- s.append_string (rq.path)
-- if attached l_uri_params.new_cursor as l_uri_params_cursor then
-- from
-- until
-- l_uri_params_cursor.after
-- loop
-- if attached l_uri_params_cursor.item as l_uri_param then
-- s.append_string ("/<strong>" + l_uri_param.name + "</strong>")
-- s.append_string ("/<em>{" + l_uri_param.name + "}</em>")
-- end
-- l_uri_params_cursor.forth
-- end
-- end
-- s.append_string ("</div>%N")
-- end
-- if attached rq.parameters as l_params and then not l_params.is_empty then
-- s.append_string ("<div class=%"api-params%">Parameters: ")
-- --| show form only if we have a default format
-- if l_dft_format_name = Void then
-- s.append_string ("<span class=%"note%">to test the parameter(s), please first select a supported format.</span>%N")
-- else
-- if rq.method_post_supported then
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"POST%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
-- else
-- s.append_string ("<form id=%""+ rq.path +"%" method=%"GET%" action=%"" + ctx.script_url (rq.path) + "." + l_dft_format_name + "%">%N")
-- end
-- end
-- s.append_string ("<ul>")
-- if attached l_params.new_cursor as l_params_cursor then
-- from
-- until
-- l_params_cursor.after
-- loop
-- if attached l_params_cursor.item as l_param then
-- s.append_string ("<li><strong>" + l_param.name + "</strong>")
-- if l_param.optional then
-- s.append_string (" <em>(Optional)</em>")
-- end
-- if attached l_param.description as l_param_desc then
-- s.append_string (": <em>" + l_param_desc + "</em>")
-- end
-- if l_dft_format_name /= Void then
-- s.append (" <input name=%"" + l_param.name + "%" type=%"text%" />")
-- end
-- s.append_string ("</li>")
-- end
-- l_params_cursor.forth
-- end
-- end
-- if l_dft_format_name /= Void then
-- s.append_string ("<input type=%"submit%" value=%"Test "+ rq.path + "." + l_dft_format_name + "%"/>")
-- s.append_string ("</form>")
-- end
-- s.append_string ("</ul></div>")
-- else
-- if l_dft_format_name /= Void then
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource + "." + l_dft_format_name) + "%">Test "+ a_resource + "." + l_dft_format_name + "</a>")
-- else
-- s.append_string ("<a class=%"api-name%" href=%"" + ctx.script_url (a_resource) + "%">Test "+ a_resource +"</a>")
-- end
-- end
s.append_string ("</div>%N")
-- end
s.append_string ("</div>%N") -- inner
end
feature -- Access
new_html_page: REST_API_DOCUMENTATION_HTML_PAGE
do
create Result.make ("API Documentation")
end
note
copyright: "Copyright (c) 1984-2012, 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,46 +1,14 @@
note
description: "Summary description for REST_REQUEST_AGENT_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
class class
REST_REQUEST_AGENT_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT] REST_REQUEST_AGENT_HANDLER
inherit inherit
WSF_AGENT_HANDLER [C] WSF_AGENT_URI_TEMPLATE_HANDLER
rename
execute as execute_application
end
REST_REQUEST_HANDLER [C]
select
execute
end
create create
make make
feature -- status note
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature -- Element change
set_authentication_required (b: like authentication_required)
do
internal_authentication_required := b
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -5,10 +5,10 @@ note
revision: "$Revision$" revision: "$Revision$"
deferred class deferred class
REST_REQUEST_HANDLER [C -> REST_REQUEST_HANDLER_CONTEXT] REST_REQUEST_HANDLER
inherit inherit
WSF_HANDLER [C] WSF_URI_TEMPLATE_HANDLER
WSF_HANDLER_HELPER WSF_HANDLER_HELPER
@@ -34,7 +34,7 @@ feature -- Element change
feature -- Execution feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler -- Execute request handler
do do
if request_method_name_supported (req.request_method) then if request_method_name_supported (req.request_method) then
@@ -52,26 +52,26 @@ feature -- Execution
execute_rescue (ctx, req, res) execute_rescue (ctx, req, res)
end end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_application (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred deferred
end end
pre_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) pre_execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do do
end end
post_execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) post_execute (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do do
end end
execute_rescue (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_rescue (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do do
post_execute (ctx, req, res) post_execute (ctx, req, res)
rescue rescue
--| Just in case, the rescue is raising other exceptions ... --| Just in case, the rescue is raising other exceptions ...
end end
execute_unauthorized (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_unauthorized (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do do
res.put_header ({HTTP_STATUS_CODE}.unauthorized, Void) res.put_header ({HTTP_STATUS_CODE}.unauthorized, Void)
res.put_string ("Unauthorized") res.put_string ("Unauthorized")
@@ -79,7 +79,7 @@ feature -- Execution
feature -- Auth feature -- Auth
authenticated (ctx: C): BOOLEAN authenticated (ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT): BOOLEAN
-- Is authenticated? -- Is authenticated?
do do
--| To redefine if needed --| To redefine if needed

View File

@@ -1,23 +0,0 @@
note
description: "Summary description for {REST_REQUEST_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_ROUTER [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT]
inherit
WSF_ROUTER [H, C]
;note
copyright: "Copyright (c) 1984-2011, 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

@@ -8,10 +8,10 @@ deferred class
REST_SERVICE REST_SERVICE
inherit inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_HANDLER_CONTEXT], REST_REQUEST_HANDLER_CONTEXT] REST_SERVICE_I
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -5,21 +5,13 @@ note
revision: "$Revision$" revision: "$Revision$"
deferred class deferred class
REST_SERVICE_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_HANDLER_CONTEXT] REST_SERVICE_I
inherit inherit
WSF_ROUTED_SERVICE_I [H, C] WSF_URI_TEMPLATE_ROUTED_SERVICE
redefine
router
end
feature -- Setup
router: REST_REQUEST_ROUTER [H, C]
-- Request router
;note ;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -1,24 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_REQUEST_URI_HANDLER
inherit
REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
;note
copyright: "Copyright (c) 1984-2011, 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,40 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTER
inherit
REST_REQUEST_URI_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
map_agent_with_request_methods
end
create
make
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable WSF_ROUTER_METHODS)
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT]
do
create h.make (a_action)
map_with_request_methods (a_id, h, rqst_methods)
end
note
copyright: "Copyright (c) 1984-2012, 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,36 +0,0 @@
note
description: "Summary description for {REST_REQUEST_URI_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
inherit
WSF_URI_ROUTER_I [H, C]
REST_REQUEST_ROUTER [H, C]
create
make
feature -- Mapping
-- map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: like {REST_REQUEST_AGENT_HANDLER}.action; rqst_methods: detachable ARRAY [READABLE_STRING_8])
-- do
-- Precursor (a_id, a_action, rqst_methods)
-- end
note
copyright: "Copyright (c) 1984-2011, 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,33 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTING_HANDLER
inherit
REST_REQUEST_URI_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
router
end
create
make
feature {NONE} -- Routing
router: REST_REQUEST_URI_ROUTER
;note
copyright: "Copyright (c) 1984-2011, 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,64 +0,0 @@
note
description: "Summary description for {WSF_ROUTING_HANDLER }."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
C -> REST_REQUEST_URI_HANDLER_CONTEXT create make end]
inherit
WSF_URI_ROUTING_HANDLER_I [H, C]
redefine
router,
execute
end
REST_REQUEST_HANDLER [C]
undefine
execute
end
create
make
feature -- Status report
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
Precursor {WSF_URI_ROUTING_HANDLER_I} (ctx, req, res)
end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end
feature {NONE} -- Routing
router: REST_REQUEST_URI_ROUTER_I [H, C]
;note
copyright: "Copyright (c) 1984-2011, 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,30 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_URI_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
REST_URI_SERVICE
inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_HANDLER_CONTEXT], REST_REQUEST_URI_HANDLER_CONTEXT]
redefine
router
end
feature -- Router
router: REST_REQUEST_URI_ROUTER
;note
copyright: "Copyright (c) 1984-2011, 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

@@ -8,11 +8,11 @@ deferred class
REST_REQUEST_URI_TEMPLATE_HANDLER REST_REQUEST_URI_TEMPLATE_HANDLER
inherit inherit
REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] REST_REQUEST_HANDLER
;note ;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -1,41 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTER
inherit
REST_REQUEST_URI_TEMPLATE_ROUTER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
redefine
map_agent_with_request_methods
end
create
make,
make_with_base_url
feature -- Mapping
map_agent_with_request_methods (a_id: READABLE_STRING_8; a_action: PROCEDURE [ANY, TUPLE [ctx: REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]];
rqst_methods: detachable WSF_ROUTER_METHODS)
local
h: REST_REQUEST_AGENT_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
do
create h.make (a_action)
map_with_request_methods (a_id, h, rqst_methods)
end
note
copyright: "Copyright (c) 1984-2012, 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,29 +0,0 @@
note
description: "Summary description for {REST_REQUEST_URI_TEMPLATE_ROUTER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTER_I [H -> REST_REQUEST_HANDLER [C], C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
inherit
WSF_URI_TEMPLATE_ROUTER_I [H, C]
REST_REQUEST_ROUTER [H, C]
create
make,
make_with_base_url
note
copyright: "Copyright (c) 1984-2012, 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,34 +0,0 @@
note
description: "Summary description for {DEFAULT_REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER
inherit
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT]
redefine
router
end
create
make,
make_with_base_url
feature {NONE} -- Routing
router: REST_REQUEST_URI_TEMPLATE_ROUTER
;note
copyright: "Copyright (c) 1984-2012, 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_ROUTING_HANDLER }."
author: ""
date: "$Date$"
revision: "$Revision$"
class
REST_REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I [H -> REST_REQUEST_HANDLER [C],
C -> REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT create make end]
inherit
WSF_URI_TEMPLATE_ROUTING_HANDLER_I [H, C]
redefine
router,
execute
end
REST_REQUEST_HANDLER [C]
undefine
execute
end
create
make,
make_with_base_url
feature -- Status report
authentication_required (req: WSF_REQUEST): BOOLEAN
do
Result := internal_authentication_required
end
feature {NONE} -- Implementation
internal_authentication_required: BOOLEAN
feature -- Execution
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
pre_execute (ctx, req, res)
Precursor {WSF_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
post_execute (ctx, req, res)
end
execute_application (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
do
check should_not_occur: False end
end
feature {NONE} -- Routing
router: REST_REQUEST_URI_TEMPLATE_ROUTER_I [H, C]
;note
copyright: "Copyright (c) 1984-2012, 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

@@ -8,17 +8,10 @@ deferred class
REST_URI_TEMPLATE_SERVICE REST_URI_TEMPLATE_SERVICE
inherit inherit
REST_SERVICE_I [REST_REQUEST_HANDLER [REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT], REST_REQUEST_URI_TEMPLATE_HANDLER_CONTEXT] REST_SERVICE_I
redefine
router
end
feature -- Router
router: REST_REQUEST_URI_TEMPLATE_ROUTER
;note ;note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -5,16 +5,27 @@ note
revision: "$Revision$" revision: "$Revision$"
class class
AUTHENTICATION_FILTER [C -> WSF_URI_TEMPLATE_HANDLER_CONTEXT] AUTHENTICATION_FILTER
inherit inherit
WSF_FILTER_HANDLER [C] WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
SHARED_DATABASE_API SHARED_DATABASE_API
WSF_URI_TEMPLATE_HANDLER
WSF_RESOURCE_HANDLER_HELPER
-- redefine
-- do_get
-- end
SHARED_DATABASE_API
SHARED_EJSON
feature -- Basic operations feature -- Basic operations
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter -- Execute the filter
local local
l_auth: HTTP_AUTHORIZATION l_auth: HTTP_AUTHORIZATION
@@ -24,15 +35,24 @@ feature -- Basic operations
attached Db_access.users.item (1) as l_user and then attached Db_access.users.item (1) as l_user and then
(attached l_auth.login as l_auth_login and then l_auth_login.is_equal (l_user.name) (attached l_auth.login as l_auth_login and then l_auth_login.is_equal (l_user.name)
and attached l_auth.password as l_auth_password and then l_auth_password.is_equal (l_user.password)) then and attached l_auth.password as l_auth_password and then l_auth_password.is_equal (l_user.password)) then
execute_next (ctx, req, res) execute_next (req, res)
else else
handle_unauthorized ("Unauthorized", ctx, req, res) handle_unauthorized ("Unauthorized", req, res)
end
end
feature -- Filter
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end end
end end
feature {NONE} -- Implementation feature {NONE} -- Implementation
handle_unauthorized (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) handle_unauthorized (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle forbidden. -- Handle forbidden.
local local
h: HTTP_HEADER h: HTTP_HEADER

View File

@@ -10,7 +10,7 @@ class
inherit inherit
ANY ANY
WSF_URI_TEMPLATE_FILTERED_SERVICE WSF_FILTERED_SERVICE
WSF_HANDLER_HELPER WSF_HANDLER_HELPER
@@ -34,18 +34,21 @@ feature {NONE} -- Initialization
create_filter create_filter
-- Create `filter' -- Create `filter'
local local
l_router: WSF_URI_TEMPLATE_ROUTER l_router: WSF_ROUTER
l_authentication_filter: AUTHENTICATION_FILTER [WSF_URI_TEMPLATE_HANDLER_CONTEXT] l_authentication_filter_hdl: AUTHENTICATION_FILTER
l_user_filter: USER_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT] l_user_filter: USER_HANDLER
l_user_handler: WSF_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT] l_user_handler: WSF_URI_TEMPLATE_HANDLER
l_routing_filter: WSF_ROUTING_FILTER [WSF_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT], WSF_URI_TEMPLATE_HANDLER_CONTEXT] -- l_routing_hdl: WSF_URI_TEMPLATE_ROUTING_HANDLER --[WSF_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT], WSF_URI_TEMPLATE_HANDLER_CONTEXT]
l_routing_filter: WSF_ROUTING_FILTER
do do
create l_router.make (1) create l_router.make (1)
create l_authentication_filter create l_authentication_filter_hdl
create l_user_filter create l_user_filter
l_authentication_filter.set_next (l_user_filter) l_authentication_filter_hdl.set_next (l_user_filter)
l_user_handler := l_authentication_filter l_user_handler := l_authentication_filter_hdl
l_router.map_with_request_methods ("/user/{userid}", l_user_handler, << "GET" >>) l_router.handle_with_request_methods ("/user/{userid}", l_user_handler, l_router.methods_get)
-- l_router.map_with_request_methods ("/user/{userid}", l_user_handler, << "GET" >>)
-- create l_routing_hdl.make_with_router (l_router)
create l_routing_filter.make (l_router) create l_routing_filter.make (l_router)
l_routing_filter.set_execute_default_action (agent execute_default) l_routing_filter.set_execute_default_action (agent execute_default)
filter := l_routing_filter filter := l_routing_filter

View File

@@ -5,12 +5,14 @@ note
revision: "$Revision$" revision: "$Revision$"
class class
USER_HANDLER [C -> WSF_HANDLER_CONTEXT] USER_HANDLER
inherit inherit
WSF_FILTER_HANDLER [C] WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
WSF_RESOURCE_HANDLER_HELPER [C] WSF_URI_TEMPLATE_HANDLER
WSF_RESOURCE_HANDLER_HELPER
redefine redefine
do_get do_get
end end
@@ -21,13 +23,13 @@ inherit
feature -- Basic operations feature -- Basic operations
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler -- Execute request handler
do do
execute_methods (ctx, req, res) execute_methods (req, res)
end end
do_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Using GET to retrieve resource information. -- Using GET to retrieve resource information.
-- If the GET request is SUCCESS, we response with -- If the GET request is SUCCESS, we response with
-- 200 OK, and a representation of the user -- 200 OK, and a representation of the user
@@ -39,16 +41,16 @@ feature -- Basic operations
if attached req.orig_path_info as orig_path then if attached req.orig_path_info as orig_path then
id := get_user_id_from_path (orig_path) id := get_user_id_from_path (orig_path)
if attached retrieve_user (id) as l_user then if attached retrieve_user (id) as l_user then
compute_response_get (ctx, req, res, l_user) compute_response_get (req, res, l_user)
else else
handle_resource_not_found_response ("The following resource " + orig_path + " is not found ", ctx, req, res) handle_resource_not_found_response ("The following resource " + orig_path + " is not found ", req, res)
end end
end end
end end
feature {NONE} -- Implementation feature {NONE} -- Implementation
compute_response_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_user : USER) compute_response_get (req: WSF_REQUEST; res: WSF_RESPONSE; l_user : USER)
local local
h: HTTP_HEADER h: HTTP_HEADER
l_msg : STRING l_msg : STRING

View File

@@ -5,10 +5,23 @@ note
revision: "$Revision$" revision: "$Revision$"
class class
ORDER_HANDLER [C -> WSF_HANDLER_CONTEXT] ORDER_HANDLER
inherit inherit
WSF_HANDLER [C] WSF_URI_HANDLER
WSF_RESOURCE_HANDLER_HELPER [C] rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine redefine
do_get, do_get,
do_post, do_post,
@@ -22,10 +35,16 @@ inherit
feature -- execute feature -- execute
execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler -- Execute request handler
do do
execute_methods (ctx, req, res) execute_methods (req, res)
end
uri_template_execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end end
feature -- API DOC feature -- API DOC
@@ -34,7 +53,7 @@ feature -- API DOC
feature -- HTTP Methods feature -- HTTP Methods
do_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Using GET to retrieve resource information. -- Using GET to retrieve resource information.
-- If the GET request is SUCCESS, we response with -- If the GET request is SUCCESS, we response with
-- 200 OK, and a representation of the order -- 200 OK, and a representation of the order
@@ -49,12 +68,12 @@ feature -- HTTP Methods
id := get_order_id_from_path (orig_path) id := get_order_id_from_path (orig_path)
if attached retrieve_order (id) as l_order then if attached retrieve_order (id) as l_order then
if is_conditional_get (req, l_order) then if is_conditional_get (req, l_order) then
handle_resource_not_modified_response ("The resource" + orig_path + "does not change", ctx, req, res) handle_resource_not_modified_response ("The resource" + orig_path + "does not change", req, res)
else else
compute_response_get (ctx, req, res, l_order) compute_response_get (req, res, l_order)
end end
else else
handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", ctx, req, res) handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", req, res)
end end
end end
end end
@@ -74,7 +93,7 @@ feature -- HTTP Methods
end end
end end
compute_response_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) compute_response_get (req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER)
local local
h: HTTP_HEADER h: HTTP_HEADER
l_msg : STRING l_msg : STRING
@@ -96,7 +115,7 @@ feature -- HTTP Methods
end end
end end
do_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Updating a resource with PUT -- Updating a resource with PUT
-- A successful PUT request will not create a new resource, instead it will -- A successful PUT request will not create a new resource, instead it will
-- change the state of the resource identified by the current uri. -- change the state of the resource identified by the current uri.
@@ -120,16 +139,16 @@ feature -- HTTP Methods
if is_valid_to_update(l_order) then if is_valid_to_update(l_order) then
if is_conditional_put (req, l_order) then if is_conditional_put (req, l_order) then
update_order( l_order) update_order( l_order)
compute_response_put (ctx, req, res, l_order) compute_response_put (req, res, l_order)
else else
handle_precondition_fail_response ("", ctx, req, res) handle_precondition_fail_response ("", req, res)
end end
else else
--| FIXME: Here we need to define the Allow methods --| FIXME: Here we need to define the Allow methods
handle_resource_conflict_response (l_put +"%N There is conflict while trying to update the order, the order could not be update in the current state", ctx, req, res) handle_resource_conflict_response (l_put +"%N There is conflict while trying to update the order, the order could not be update in the current state", req, res)
end end
else else
handle_bad_request_response (l_put +"%N is not a valid ORDER, maybe the order does not exist in the system", ctx, req, res) handle_bad_request_response (l_put +"%N is not a valid ORDER, maybe the order does not exist in the system", req, res)
end end
end end
end end
@@ -153,7 +172,7 @@ feature -- HTTP Methods
end end
compute_response_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) compute_response_put (req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER)
local local
h: HTTP_HEADER h: HTTP_HEADER
joc : JSON_ORDER_CONVERTER joc : JSON_ORDER_CONVERTER
@@ -179,7 +198,7 @@ feature -- HTTP Methods
end end
do_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Here we use DELETE to cancel an order, if that order is in state where -- Here we use DELETE to cancel an order, if that order is in state where
-- it can still be canceled. -- it can still be canceled.
-- 200 if is ok -- 200 if is ok
@@ -194,18 +213,18 @@ feature -- HTTP Methods
if db_access.orders.has_key (id) then if db_access.orders.has_key (id) then
if is_valid_to_delete (id) then if is_valid_to_delete (id) then
delete_order( id) delete_order( id)
compute_response_delete (ctx, req, res) compute_response_delete (req, res)
else else
--| FIXME: Here we need to define the Allow methods --| FIXME: Here we need to define the Allow methods
handle_method_not_allowed_response (orig_path + "%N There is conflict while trying to delete the order, the order could not be deleted in the current state", ctx, req, res) handle_method_not_allowed_response (orig_path + "%N There is conflict while trying to delete the order, the order could not be deleted in the current state", req, res)
end end
else else
handle_resource_not_found_response (orig_path + " not found in this server", ctx, req, res) handle_resource_not_found_response (orig_path + " not found in this server", req, res)
end end
end end
end end
compute_response_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) compute_response_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -218,7 +237,7 @@ feature -- HTTP Methods
res.put_header_text (h.string) res.put_header_text (h.string)
end end
do_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Here the convention is the following. -- Here the convention is the following.
-- POST is used for creation and the server determines the URI -- POST is used for creation and the server determines the URI
-- of the created resource. -- of the created resource.
@@ -233,13 +252,13 @@ feature -- HTTP Methods
l_post := retrieve_data (req) l_post := retrieve_data (req)
if attached extract_order_request (l_post) as l_order then if attached extract_order_request (l_post) as l_order then
save_order (l_order) save_order (l_order)
compute_response_post (ctx, req, res, l_order) compute_response_post (req, res, l_order)
else else
handle_bad_request_response (l_post +"%N is not a valid ORDER", ctx, req, res) handle_bad_request_response (l_post +"%N is not a valid ORDER", req, res)
end end
end end
compute_response_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) compute_response_post (req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER)
local local
h: HTTP_HEADER h: HTTP_HEADER
l_msg : STRING l_msg : STRING

View File

@@ -1,6 +1,5 @@
note note
description : "Objects that ..." description : "REST Buck server"
author : "$Author$"
date : "$Date$" date : "$Date$"
revision : "$Revision$" revision : "$Revision$"
@@ -30,11 +29,11 @@ feature {NONE} -- Initialization
setup_router setup_router
local local
order_handler: ORDER_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT] order_handler: ORDER_HANDLER
do do
create order_handler create order_handler
router.map_with_request_methods ("/order", order_handler, <<"POST">>) router.handle_with_request_methods ("/order", order_handler, router.methods_POST)
router.map_with_request_methods ("/order/{orderid}", order_handler, <<"GET", "DELETE", "PUT">>) router.handle_with_request_methods ("/order/{orderid}", order_handler, router.methods_GET + router.methods_DELETE + router.methods_PUT)
end end
feature -- Execution feature -- Execution

View File

@@ -10,8 +10,12 @@ class
inherit inherit
ANY ANY
WSF_ROUTED_SERVICE
WSF_URI_TEMPLATE_ROUTED_SERVICE WSF_URI_TEMPLATE_ROUTED_SERVICE
WSF_URI_ROUTED_SERVICE
WSF_DEFAULT_SERVICE WSF_DEFAULT_SERVICE
create create
@@ -34,14 +38,14 @@ feature {NONE} -- Initialization
setup_router setup_router
-- Setup router -- Setup router
local local
www: WSF_FILE_SYSTEM_HANDLER [WSF_URI_TEMPLATE_HANDLER_CONTEXT] www: WSF_FILE_SYSTEM_HANDLER
do do
router.map_agent ("/upload{?nb}", agent execute_upload) map_uri_template_agent ("/upload{?nb}", agent execute_upload)
create www.make (document_root) create www.make (document_root)
www.set_directory_index (<<"index.html">>) www.set_directory_index (<<"index.html">>)
www.set_not_found_handler (agent execute_not_found) www.set_not_found_handler (agent execute_not_found)
router.map_with_request_methods ("{/path}{?query}", www, <<"GET">>) router.handle_with_request_methods ("", www, router.methods_GET)
end end
feature -- Configuration feature -- Configuration
@@ -59,6 +63,8 @@ feature -- Configuration
if Result [Result.count] = Operating_environment.directory_separator then if Result [Result.count] = Operating_environment.directory_separator then
Result := Result.substring (1, Result.count - 1) Result := Result.substring (1, Result.count - 1)
end end
ensure
not Result.ends_with (Operating_environment.directory_separator.out)
end end
files_root: READABLE_STRING_8 files_root: READABLE_STRING_8
@@ -79,7 +85,7 @@ feature -- Execution
res.redirect_now_with_content (req.script_url ("/"), "Redirection to " + req.script_url ("/"), "text/html") res.redirect_now_with_content (req.script_url ("/"), "Redirection to " + req.script_url ("/"), "text/html")
end end
execute_not_found (uri: READABLE_STRING_8; ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) execute_not_found (uri: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
-- `uri' is not found, redirect to default page -- `uri' is not found, redirect to default page
do do
res.redirect_now_with_content (req.script_url ("/"), uri + ": not found.%NRedirection to " + req.script_url ("/"), "text/html") res.redirect_now_with_content (req.script_url ("/"), uri + ": not found.%NRedirection to " + req.script_url ("/"), "text/html")

View File

@@ -0,0 +1,36 @@
note
description: "Summary description for {WSF_STARTS_WITH_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_STARTS_WITH_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_uri: READABLE_STRING_8): WSF_STARTS_WITH_MAPPING
do
create Result.make (a_uri, Current)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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,5 +1,5 @@
note note
description: "Summary description for EWF_URI_PATH." description: "Summary description for EWF_STARTS_WITH_PATH."
author: "" author: ""
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"

View File

@@ -22,13 +22,13 @@ feature -- Initialization
feature -- Access feature -- Access
action: FUNCTION [ANY, TUPLE [ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST], WSF_RESPONSE_MESSAGE] action: FUNCTION [ANY, TUPLE [req: WSF_REQUEST], WSF_RESPONSE_MESSAGE]
feature -- Execution feature -- Execution
response (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
do do
Result := action.item ([ctx, req]) Result := action.item ([req])
end end
note note

View File

@@ -0,0 +1,36 @@
note
description: "Summary description for {EWF_ROUTER_URI_PATH_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_uri: READABLE_STRING_8): WSF_URI_MAPPING
do
create Result.make (a_uri, Current)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,47 @@
note
description: "Summary description for {WSF_URI_ROUTED_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_ROUTED_SERVICE
inherit
WSF_ROUTED_SERVICE
feature -- Mapping helper: uri
map_uri (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER)
do
map_uri_with_request_methods (a_uri, h, Void)
end
map_uri_with_request_methods (a_uri: READABLE_STRING_8; h: WSF_URI_HANDLER; rqst_methods: detachable WSF_ROUTER_METHODS)
do
router.map_with_request_methods (create {WSF_URI_MAPPING}.make (a_uri, h), rqst_methods)
end
feature -- Mapping helper: uri agent
map_uri_agent (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
do
map_uri_agent_with_request_methods (a_uri, proc, Void)
end
map_uri_agent_with_request_methods (a_uri: READABLE_STRING_8; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_ROUTER_METHODS)
do
map_uri_with_request_methods (a_uri, create {WSF_AGENT_URI_HANDLER}.make (proc), rqst_methods)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -12,7 +12,7 @@ inherit
feature -- Response feature -- Response
response (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST): WSF_RESPONSE_MESSAGE response (req: WSF_REQUEST): WSF_RESPONSE_MESSAGE
require require
is_valid_context: is_valid_context (req) is_valid_context: is_valid_context (req)
deferred deferred
@@ -22,10 +22,10 @@ feature -- Response
feature -- Execution feature -- Execution
execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler -- Execute request handler
do do
res.send (response (ctx, req)) res.send (response (req))
end end
note note

View File

@@ -20,13 +20,13 @@ feature {NONE} -- Initialization
action := a_action action := a_action
end end
action: PROCEDURE [ANY, TUPLE [context: WSF_URI_TEMPLATE_HANDLER_CONTEXT; request: WSF_REQUEST; response: WSF_RESPONSE]] action: PROCEDURE [ANY, TUPLE [request: WSF_REQUEST; response: WSF_RESPONSE]]
feature -- Execution feature -- Execution
execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) execute (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
action.call ([ctx, req, res]) action.call ([req, res])
end end
note note

View File

@@ -0,0 +1,36 @@
note
description: "Summary description for EWF_URI_TEMPLATE_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_tpl: READABLE_STRING_8): WSF_URI_TEMPLATE_MAPPING
do
create Result.make (a_tpl, Current)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -12,16 +12,16 @@ inherit
create create
make, make,
make_from_string make_from_template
feature {NONE} -- Initialization feature {NONE} -- Initialization
make_from_string (s: READABLE_STRING_8; h: like handler) make (s: READABLE_STRING_8; h: like handler)
do do
make (create {URI_TEMPLATE}.make (s), h) make_from_template (create {URI_TEMPLATE}.make (s), h)
end end
make (tpl: URI_TEMPLATE; h: like handler) make_from_template (tpl: URI_TEMPLATE; h: like handler)
do do
template := tpl template := tpl
handler := h handler := h
@@ -46,26 +46,26 @@ feature -- Status
local local
tpl: URI_TEMPLATE tpl: URI_TEMPLATE
p: READABLE_STRING_32 p: READABLE_STRING_32
ctx: detachable WSF_URI_TEMPLATE_HANDLER_CONTEXT new_src: detachable WSF_REQUEST_PATH_PARAMETERS_PROVIDER
do do
p := path_from_request (req) p := path_from_request (req)
tpl := based_uri_template (template, a_router) tpl := based_uri_template (template, a_router)
if attached tpl.match (p) as tpl_res then if attached tpl.match (p) as tpl_res then
Result := handler Result := handler
create ctx.make (req, tpl, tpl_res, path_from_request (req))
a_router.execute_before (Current) a_router.execute_before (Current)
--| Applied the context to the request --| Applied the context to the request
--| in practice, this will fill the {WSF_REQUEST}.path_parameters --| in practice, this will fill the {WSF_REQUEST}.path_parameters
ctx.apply (req) create new_src.make (tpl_res.path_variables.count, tpl_res.path_variables)
handler.execute (ctx, req, res) new_src.apply (req)
handler.execute (req, res)
--| Revert {WSF_REQUEST}.path_parameters_source to former value --| Revert {WSF_REQUEST}.path_parameters_source to former value
--| In case the request object passed by other handler that alters its values. --| In case the request object passed by other handler that alters its values.
ctx.revert (req) new_src.revert (req)
a_router.execute_after (Current) a_router.execute_after (Current)
end end
rescue rescue
if ctx /= Void then if new_src /= Void then
ctx.revert (req) new_src.revert (req)
end end
end end

View File

@@ -0,0 +1,47 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_ROUTED_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_ROUTED_SERVICE
inherit
WSF_ROUTED_SERVICE
feature -- Mapping helper: uri
map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER)
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_ROUTER_METHODS)
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]])
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_ROUTER_METHODS)
do
map_uri_template_with_request_methods (a_tpl, create {WSF_AGENT_URI_TEMPLATE_HANDLER}.make (proc), rqst_methods)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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,22 +1,23 @@
note note
description: "Summary description for {WSF_URI_HANDLER_CONTEXT}." description: "Summary description for {WSF_URI_TEMPLATE_ROUTING_HANDLER}."
author: "" author: ""
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
class class
REST_REQUEST_URI_HANDLER_CONTEXT WSF_URI_TEMPLATE_ROUTING_HANDLER
inherit inherit
WSF_URI_HANDLER_CONTEXT WSF_ROUTING_HANDLER
REST_REQUEST_HANDLER_CONTEXT WSF_URI_TEMPLATE_HANDLER
create create
make make,
make_with_router
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -0,0 +1,42 @@
note
description: "Summary description for {WSF_AGENT_URI_TEMPLATE_WITH_CONTEXT_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_AGENT_URI_TEMPLATE_WITH_CONTEXT_HANDLER
inherit
WSF_URI_TEMPLATE_WITH_CONTEXT_HANDLER
create
make
feature {NONE} -- Initialization
make (a_action: like action)
do
action := a_action
end
action: PROCEDURE [ANY, TUPLE [context: WSF_URI_TEMPLATE_HANDLER_CONTEXT; request: WSF_REQUEST; response: WSF_RESPONSE]]
feature -- Execution
execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do
action.call ([ctx, req, res])
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,36 @@
note
description: "Summary description for EWF_URI_TEMPLATE_WITH_CONTEXT_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_WITH_CONTEXT_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
feature {WSF_ROUTER} -- Mapping
new_mapping (a_tpl: READABLE_STRING_8): WSF_URI_TEMPLATE_WITH_CONTEXT_MAPPING
do
create Result.make (a_tpl, Current)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,95 @@
note
description: "Summary description for {EWF_ROUTER_URI_TEMPLATE_WITH_CONTEXT_PATH}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_URI_TEMPLATE_WITH_CONTEXT_MAPPING
inherit
WSF_ROUTER_MAPPING
create
make,
make_from_template
feature {NONE} -- Initialization
make (s: READABLE_STRING_8; h: like handler)
do
make_from_template (create {URI_TEMPLATE}.make (s), h)
end
make_from_template (tpl: URI_TEMPLATE; h: like handler)
do
template := tpl
handler := h
end
feature -- Access
handler: WSF_URI_TEMPLATE_WITH_CONTEXT_HANDLER
template: URI_TEMPLATE
feature -- Element change
set_handler (h: like handler)
do
handler := h
end
feature -- Status
routed_handler (req: WSF_REQUEST; res: WSF_RESPONSE; a_router: WSF_ROUTER): detachable WSF_HANDLER
local
tpl: URI_TEMPLATE
p: READABLE_STRING_32
ctx: detachable WSF_URI_TEMPLATE_HANDLER_CONTEXT
do
p := path_from_request (req)
tpl := based_uri_template (template, a_router)
if attached tpl.match (p) as tpl_res then
Result := handler
create ctx.make (req, tpl, tpl_res, path_from_request (req))
a_router.execute_before (Current)
--| Applied the context to the request
--| in practice, this will fill the {WSF_REQUEST}.path_parameters
ctx.apply (req)
handler.execute (ctx, req, res)
--| Revert {WSF_REQUEST}.path_parameters_source to former value
--| In case the request object passed by other handler that alters its values.
ctx.revert (req)
a_router.execute_after (Current)
end
rescue
if ctx /= Void then
ctx.revert (req)
end
end
feature {NONE} -- Implementation
based_uri_template (a_tpl: like template; a_router: WSF_ROUTER): like template
do
if attached a_router.base_url as l_base_url then
Result := a_tpl.duplicate
Result.set_template (l_base_url + a_tpl.template)
else
Result := a_tpl
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,47 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_WITH_CONTEXT_ROUTED_SERVICE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_WITH_CONTEXT_ROUTED_SERVICE
inherit
WSF_ROUTED_SERVICE
feature -- Mapping helper: uri
map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_WITH_CONTEXT_HANDLER)
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_WITH_CONTEXT_HANDLER; rqst_methods: detachable WSF_ROUTER_METHODS)
do
router.map_with_request_methods (create {WSF_URI_TEMPLATE_WITH_CONTEXT_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 [ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]])
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 [ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE]]; rqst_methods: detachable WSF_ROUTER_METHODS)
do
map_uri_template_with_request_methods (a_tpl, create {WSF_AGENT_URI_TEMPLATE_WITH_CONTEXT_HANDLER}.make (proc), rqst_methods)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,39 @@
note
description: "Summary description for {WSF_URI_TEMPLATE_WITH_CONTEXT_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_URI_TEMPLATE_WITH_CONTEXT_ROUTING_HANDLER
inherit
WSF_ROUTING_HANDLER
WSF_URI_TEMPLATE_WITH_CONTEXT_HANDLER
rename
execute as uri_template_xecute
end
create
make,
make_with_router
feature -- Execution
uri_template_xecute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
do
execute (req, res)
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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,19 +0,0 @@
note
description: "Summary description for {WSF_STARTS_WITH_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_STARTS_WITH_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
end

View File

@@ -1,19 +0,0 @@
note
description: "Summary description for {EWF_ROUTER_URI_PATH_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
end

View File

@@ -1,19 +0,0 @@
note
description: "Summary description for EWF_URI_TEMPLATE_HANDLER."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_URI_TEMPLATE_HANDLER
inherit
WSF_HANDLER
feature -- Execution
execute (ctx: WSF_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE)
deferred
end
end

View File

@@ -20,7 +20,7 @@ feature {NONE} -- Initialization
make (d: like document_root) make (d: like document_root)
require require
valid_d: (d /= Void and then not d.is_empty) implies d.ends_with ("/") valid_d: (d /= Void and then not d.is_empty) implies not d.ends_with (operating_environment.directory_separator.out)
local local
e: EXECUTION_ENVIRONMENT e: EXECUTION_ENVIRONMENT
do do
@@ -30,6 +30,8 @@ feature {NONE} -- Initialization
else else
document_root := d document_root := d
end end
ensure
not document_root.is_empty and then not document_root.ends_with (operating_environment.directory_separator.out)
end end
feature -- Access feature -- Access
@@ -337,7 +339,7 @@ feature {NONE} -- Implementation
resource_filename (uri: READABLE_STRING_8): READABLE_STRING_8 resource_filename (uri: READABLE_STRING_8): READABLE_STRING_8
do do
Result := real_filename (document_root + real_filename (uri)) Result := real_filename (document_root + operating_environment.directory_separator.out + real_filename (uri))
end end
dirname (uri: READABLE_STRING_8): READABLE_STRING_8 dirname (uri: READABLE_STRING_8): READABLE_STRING_8
@@ -450,4 +452,14 @@ feature {NONE} -- implementation: date time
Result := date_time_utility.unix_time_stamp_to_date_time (n) Result := date_time_utility.unix_time_stamp_to_date_time (n)
end end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -14,8 +14,15 @@ feature -- Status report
do do
Result := True Result := True
end end
feature {WSF_ROUTER} -- Mapping change feature {WSF_ROUTER} -- Mapping
new_mapping (a_resource: READABLE_STRING_8): WSF_ROUTER_MAPPING
-- New mapping built with Current as handler
deferred
ensure
Result /= Void and then Result.handler = Current
end
on_mapped (a_mapping: WSF_ROUTER_MAPPING; a_rqst_methods: detachable WSF_ROUTER_METHODS) on_mapped (a_mapping: WSF_ROUTER_MAPPING; a_rqst_methods: detachable WSF_ROUTER_METHODS)
-- Callback called when a router map a route to Current handler -- Callback called when a router map a route to Current handler

View File

@@ -57,6 +57,21 @@ feature -- Mapping
a_mapping.handler.on_mapped (a_mapping, rqst_methods) a_mapping.handler.on_mapped (a_mapping, rqst_methods)
end end
feature -- Mapping handler
handle (a_resource: READABLE_STRING_8; h: WSF_HANDLER)
-- Map the mapping associated to handler `h' for resource `a_resource'
do
handle_with_request_methods (a_resource, h, Void)
end
handle_with_request_methods (a_resource: READABLE_STRING_8; h: WSF_HANDLER; rqst_methods: detachable WSF_ROUTER_METHODS)
-- Map the mapping associated to handler `h' for resource `a_resource'
-- and only for request methods `rqst_methods'
do
map_with_request_methods (h.new_mapping (a_resource), rqst_methods)
end
feature -- Access feature -- Access
is_dispatched: BOOLEAN is_dispatched: BOOLEAN

View File

@@ -7,6 +7,12 @@ note
deferred class deferred class
WSF_ROUTER_MAPPING WSF_ROUTER_MAPPING
feature {NONE} -- Initialization
make (a_resource: READABLE_STRING_8; h: like handler)
deferred
end
feature -- Access feature -- Access
handler: WSF_HANDLER handler: WSF_HANDLER

View File

@@ -62,11 +62,7 @@ feature {NONE} -- Initialization
make_from_iterable (v: ITERABLE [READABLE_STRING_8]) make_from_iterable (v: ITERABLE [READABLE_STRING_8])
do do
make (1) make (1)
across add_methods (v)
v as vc
loop
add_method_using_constant (vc.item)
end
end end
make_from_string (v: READABLE_STRING_8) make_from_string (v: READABLE_STRING_8)
@@ -115,6 +111,19 @@ feature -- Status change
is_locked := True is_locked := True
end end
feature -- Basic operations
add alias "+" (a_other: WSF_ROUTER_METHODS): WSF_ROUTER_METHODS
-- Merge Current and a_other into Result
require
a_other_not_void: a_other /= Void
do
create Result.make_from_iterable (Current)
Result.add_methods (a_other)
ensure
end
feature -- Element change feature -- Element change
enable_get enable_get
@@ -328,7 +337,21 @@ feature -- Access
Result := methods.to_array Result := methods.to_array
end end
feature {NONE} -- Implementation feature {WSF_ROUTER_METHODS} -- Implementation
add_methods (lst: ITERABLE [READABLE_STRING_8])
-- Enable methods from `lst'
do
if not is_locked then
across
lst as c
loop
add_method_using_constant (c.item)
end
end
end
feature {NONE} -- Implementation
add_method_using_constant (v: READABLE_STRING_8) add_method_using_constant (v: READABLE_STRING_8)
-- Add method `v' using method_* constant -- Add method `v' using method_* constant
@@ -358,15 +381,6 @@ feature {NONE} -- Implementation
method_set: has (v.as_upper) method_set: has (v.as_upper)
end end
add_method (v: READABLE_STRING_8)
require
is_upper_case: v.same_string (v.as_upper)
do
if not is_locked then
methods.extend (v)
end
end
prune_method (v: READABLE_STRING_8) prune_method (v: READABLE_STRING_8)
require require
is_upper_case: v.same_string (v.as_upper) is_upper_case: v.same_string (v.as_upper)

View File

@@ -0,0 +1,75 @@
note
description: "Summary description for {WSF_ROUTING_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_ROUTING_HANDLER
inherit
WSF_HANDLER
feature {NONE} -- Initialization
make_with_router (a_router: like router)
do
router := a_router
end
make (n: INTEGER)
do
make_with_router (create {WSF_ROUTER}.make (n))
end
feature -- Access
router: WSF_ROUTER
feature -- Access
count: INTEGER
-- Count of maps handled by current
do
Result := router.count
end
base_url: detachable READABLE_STRING_8
do
Result := router.base_url
end
feature -- Element change
set_base_url (a_base_url: like base_url)
-- Set `base_url' to `a_base_url'
-- make sure no map is already added (i.e: count = 0)
require
no_handler_set: count = 0
do
router.set_base_url (a_base_url)
end
feature -- Execution
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
if attached router.dispatch_and_return_handler (req, res) as h then
check is_dispatched: router.is_dispatched end
else
res.put_header ({HTTP_STATUS_CODE}.not_found, <<[{HTTP_HEADER_NAMES}.header_content_length, "0"]>>)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -8,19 +8,19 @@ note
revision: "$Revision$" revision: "$Revision$"
deferred class deferred class
WSF_FILTER_HANDLER [C -> WSF_HANDLER_CONTEXT] WSF_FILTER_HANDLER [H -> WSF_HANDLER]
inherit inherit
WSF_HANDLER [C] WSF_HANDLER
feature -- Access feature -- Access
next: detachable WSF_FILTER_HANDLER [C] next: detachable H
-- Next filter -- Next handler
feature -- Element change feature -- Element change
set_next (a_next: WSF_FILTER_HANDLER [C]) set_next (a_next: like next)
-- Set `next' to `a_next' -- Set `next' to `a_next'
do do
next := a_next next := a_next
@@ -28,16 +28,6 @@ feature -- Element change
next_set: next = a_next next_set: next = a_next
end end
feature {NONE} -- Implementation
execute_next (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the `next' filter.
do
if attached next as n then
n.execute (ctx, req, res)
end
end
note note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"

View File

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
WSF_FILTER_URI_HANDLER
inherit
WSF_FILTER_HANDLER [WSF_URI_HANDLER]
WSF_URI_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,34 @@
note
description : "Objects that ..."
author : "$Author$"
date : "$Date$"
revision : "$Revision$"
deferred class
WSF_FILTER_URI_TEMPLATE_HANDLER
inherit
WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER]
WSF_URI_TEMPLATE_HANDLER
feature -- Execution
execute_next (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached next as n then
n.execute (req, res)
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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,11 +1,11 @@
note note
description: "Summary description for {WSF_URI_TEMPLATE_FILTERED_SERVICE}." description: "Summary description for {WSF_FILTERED_SERVICE}."
author: "" author: ""
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
deferred class deferred class
WSF_URI_TEMPLATE_FILTERED_SERVICE WSF_FILTERED_SERVICE
feature {NONE} -- Initialization feature {NONE} -- Initialization

View File

@@ -1,75 +0,0 @@
note
description: "Routing filter."
author: "Olivier Ligot"
date: "$Date$"
revision: "$Revision$"
class
WSF_ROUTING_FILTER [H -> WSF_HANDLER [C], C -> WSF_HANDLER_CONTEXT]
inherit
WSF_FILTER
create
make
feature {NONE} -- Initialization
make (a_router: WSF_ROUTER [H, C])
do
router := a_router
ensure
router_set: router = a_router
end
feature -- Access
router: WSF_ROUTER [H, C]
-- Router
execute_default_action: detachable PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]
-- `execute_default' action
feature -- Element change
set_execute_default_action (an_action: like execute_default_action)
-- Set `execute_default_action' to `an_action'
do
execute_default_action := an_action
ensure
execute_default_action_set: execute_default_action = an_action
end
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
do
if attached router.route (req) as r then
router.execute_route (r, req, res)
else
execute_default (req, res)
end
execute_next (req, res)
end
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
do
if attached execute_default_action as action then
action.call ([req, res])
else
do_nothing
end
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -0,0 +1,59 @@
note
description: "Summary description for {WSF_REQUEST_PATH_PARAMETERS_PROVIDER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_REQUEST_PATH_PARAMETERS_PROVIDER
inherit
WSF_REQUEST_PATH_PARAMETERS_SOURCE
create
make
feature {NONE} -- Initialization
make (nb: INTEGER; a_urlencoded_path_parameters: like urlencoded_path_parameters)
do
path_parameters_count := nb
urlencoded_path_parameters := a_urlencoded_path_parameters
end
feature -- Access
path_parameters_count: INTEGER
urlencoded_path_parameters: TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_8]
-- Raw urlencoded path parameters.
feature -- Operation
previous_path_parameters_source: detachable WSF_REQUEST_PATH_PARAMETERS_SOURCE
apply (req: WSF_REQUEST)
-- <Precursor>
do
previous_path_parameters_source := req.path_parameters_source
req.set_path_parameters_source (Current)
end
revert (req: WSF_REQUEST)
-- <Precursor>
do
req.set_path_parameters_source (previous_path_parameters_source)
previous_path_parameters_source := Void
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, 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

@@ -5,160 +5,160 @@ note
revision: "$Revision$" revision: "$Revision$"
class class
WSF_RESOURCE_HANDLER_HELPER [C -> WSF_HANDLER_CONTEXT] WSF_RESOURCE_HANDLER_HELPER
feature -- Execute template feature -- Execute template
execute_methods (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_methods (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request and dispatch according to the request method -- Execute request and dispatch according to the request method
local local
m: READABLE_STRING_8 m: READABLE_STRING_8
do do
m := req.request_method.as_upper m := req.request_method.as_upper
if m.same_string ({HTTP_REQUEST_METHODS}.method_get) then if m.same_string ({HTTP_REQUEST_METHODS}.method_get) then
execute_get (ctx, req, res) execute_get (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_put) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_put) then
execute_put (ctx, req, res) execute_put (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_delete) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_delete) then
execute_delete (ctx, req, res) execute_delete (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_post) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_post) then
execute_post (ctx, req, res) execute_post (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_trace) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_trace) then
execute_trace (ctx, req, res) execute_trace (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_options) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_options) then
execute_options (ctx, req, res) execute_options (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_head) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_head) then
execute_head (ctx, req, res) execute_head (req, res)
elseif m.same_string ({HTTP_REQUEST_METHODS}.method_connect) then elseif m.same_string ({HTTP_REQUEST_METHODS}.method_connect) then
execute_connect (ctx, req, res) execute_connect (req, res)
else else
--| Eventually handle other methods... --| Eventually handle other methods...
execute_extension_method (ctx, req, res) execute_extension_method (req, res)
end end
end end
feature -- Method Post feature -- Method Post
execute_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_post (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
if req.is_chunked_input then if req.is_chunked_input then
do_post (ctx, req, res) do_post (req, res)
else else
if req.content_length_value > 0 then if req.content_length_value > 0 then
do_post (ctx, req, res) do_post (req, res)
else else
handle_bad_request_response ("Bad request, content_length empty", ctx, req, res) handle_bad_request_response ("Bad request, content_length empty", req, res)
end end
end end
end end
do_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method POST not implemented", ctx, req, res) handle_not_implemented ("Method POST not implemented", req, res)
end end
feature-- Method Put feature-- Method Put
execute_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_put (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
if req.is_chunked_input then if req.is_chunked_input then
do_put (ctx, req, res) do_put (req, res)
else else
if req.content_length_value > 0 then if req.content_length_value > 0 then
do_put (ctx, req, res) do_put (req, res)
else else
handle_bad_request_response ("Bad request, content_length empty", ctx, req, res) handle_bad_request_response ("Bad request, content_length empty", req, res)
end end
end end
end end
do_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method PUT not implemented", ctx, req, res) handle_not_implemented ("Method PUT not implemented", req, res)
end end
feature -- Method Get feature -- Method Get
execute_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_get (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_get (ctx, req, res) do_get (req, res)
end end
do_get (ctx: C;req: WSF_REQUEST; res: WSF_RESPONSE) do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method GET not implemented", ctx, req, res) handle_not_implemented ("Method GET not implemented", req, res)
end end
feature -- Method DELETE feature -- Method DELETE
execute_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_delete (ctx, req, res) do_delete (req, res)
end end
do_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method DELETE not implemented", ctx, req, res) handle_not_implemented ("Method DELETE not implemented", req, res)
end end
feature -- Method CONNECT feature -- Method CONNECT
execute_connect (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_connect (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_connect (ctx, req, res) do_connect (req, res)
end end
do_connect (ctx: C;req: WSF_REQUEST; res: WSF_RESPONSE) do_connect (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method CONNECT not implemented", ctx, req, res) handle_not_implemented ("Method CONNECT not implemented", req, res)
end end
feature -- Method HEAD feature -- Method HEAD
execute_head (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_head (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_head (ctx, req, res) do_head (req, res)
end end
do_head (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_head (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method HEAD not implemented", ctx, req, res) handle_not_implemented ("Method HEAD not implemented", req, res)
end end
feature -- Method OPTIONS feature -- Method OPTIONS
execute_options (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_options (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_options (ctx, req, res) do_options (req, res)
end end
do_options (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_options (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method OPTIONS not implemented", ctx, req, res) handle_not_implemented ("Method OPTIONS not implemented", req, res)
end end
feature -- Method TRACE feature -- Method TRACE
execute_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_trace (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_trace (ctx, req, res) do_trace (req, res)
end end
do_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_trace (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method TRACE not implemented", ctx, req, res) handle_not_implemented ("Method TRACE not implemented", req, res)
end end
feature -- Method Extension Method feature -- Method Extension Method
execute_extension_method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) execute_extension_method (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
do_extension_method (ctx, req, res) do_extension_method (req, res)
end end
do_extension_method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do_extension_method (req: WSF_REQUEST; res: WSF_RESPONSE)
do do
handle_not_implemented ("Method extension-method not implemented", ctx, req, res) handle_not_implemented ("Method extension-method not implemented", req, res)
end end
feature -- Retrieve content from WGI_INPUT_STREAM feature -- Retrieve content from WGI_INPUT_STREAM
@@ -208,7 +208,7 @@ feature -- Handle responses
Result := Void Result := Void
end end
handle_bad_request_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE ) handle_bad_request_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE )
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -221,7 +221,7 @@ feature -- Handle responses
res.put_string (a_description) res.put_string (a_description)
end end
handle_precondition_fail_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE ) handle_precondition_fail_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE )
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -234,7 +234,7 @@ feature -- Handle responses
res.put_string (a_description) res.put_string (a_description)
end end
handle_internal_server_error (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE ) handle_internal_server_error (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE )
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -247,7 +247,7 @@ feature -- Handle responses
res.put_string (a_description) res.put_string (a_description)
end end
handle_not_implemented (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE ) handle_not_implemented (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE )
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -260,7 +260,7 @@ feature -- Handle responses
res.put_string (a_description) res.put_string (a_description)
end end
handle_method_not_allowed_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) handle_method_not_allowed_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -273,7 +273,7 @@ feature -- Handle responses
res.put_string (a_description) res.put_string (a_description)
end end
handle_resource_not_found_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) handle_resource_not_found_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -287,7 +287,7 @@ feature -- Handle responses
end end
handle_resource_not_modified_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) handle_resource_not_modified_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
h : HTTP_HEADER h : HTTP_HEADER
do do
@@ -302,7 +302,7 @@ feature -- Handle responses
end end
handle_resource_conflict_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) handle_resource_conflict_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
h : HTTP_HEADER h : HTTP_HEADER
do do