diff --git a/library/server/wsf/router/context/wsf_context_handler.e b/library/server/wsf/router/context/wsf_context_handler.e index f684f7a5..d2bba94a 100644 --- a/library/server/wsf/router/context/wsf_context_handler.e +++ b/library/server/wsf/router/context/wsf_context_handler.e @@ -16,13 +16,6 @@ feature -- Execution deferred end -feature {WSF_ROUTER} -- Mapping - - new_mapping (a_resource: READABLE_STRING_8): WSF_ROUTER_MAPPING - -- New mapping built with Current as handler - deferred - 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)" diff --git a/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_routing_handler.e b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_routing_handler.e new file mode 100644 index 00000000..c2539545 --- /dev/null +++ b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_routing_handler.e @@ -0,0 +1,29 @@ +note + description: "Summary description for {WSF_STARTS_WITH_ROUTING_HANDLER}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_STARTS_WITH_ROUTING_HANDLER + +inherit + WSF_ROUTING_HANDLER + + WSF_STARTS_WITH_HANDLER + +create + make, + make_with_router + +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 diff --git a/library/server/wsf/router/support/starts_with/wsf_starts_with_handler.e b/library/server/wsf/router/support/starts_with/wsf_starts_with_handler.e index 3eaa14c3..b2b63220 100644 --- a/library/server/wsf/router/support/starts_with/wsf_starts_with_handler.e +++ b/library/server/wsf/router/support/starts_with/wsf_starts_with_handler.e @@ -10,6 +10,8 @@ deferred class inherit WSF_HANDLER + WSF_ROUTER_MAPPING_FACTORY + feature -- Execution execute (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_routing_handler.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_routing_handler.e new file mode 100644 index 00000000..41a3f5cb --- /dev/null +++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_routing_handler.e @@ -0,0 +1,29 @@ +note + description: "Summary description for {WSF_URI_ROUTING_HANDLER}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + WSF_URI_ROUTING_HANDLER + +inherit + WSF_ROUTING_HANDLER + + WSF_URI_HANDLER + +create + make, + make_with_router + +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 diff --git a/library/server/wsf/router/support/uri/wsf_uri_handler.e b/library/server/wsf/router/support/uri/wsf_uri_handler.e index 04d97f60..080c1b24 100644 --- a/library/server/wsf/router/support/uri/wsf_uri_handler.e +++ b/library/server/wsf/router/support/uri/wsf_uri_handler.e @@ -10,6 +10,8 @@ deferred class inherit WSF_HANDLER + WSF_ROUTER_MAPPING_FACTORY + feature -- Execution execute (req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/router/support/uri_template/wsf_uri_template_handler.e b/library/server/wsf/router/support/uri_template/wsf_uri_template_handler.e index 4e3866d6..276c4b7e 100644 --- a/library/server/wsf/router/support/uri_template/wsf_uri_template_handler.e +++ b/library/server/wsf/router/support/uri_template/wsf_uri_template_handler.e @@ -10,6 +10,8 @@ deferred class inherit WSF_HANDLER + WSF_ROUTER_MAPPING_FACTORY + feature -- Execution execute (req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_handler.e b/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_handler.e index 28aa3e59..2987f352 100644 --- a/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_handler.e +++ b/library/server/wsf/router/support/uri_template_with_context/wsf_uri_template_context_handler.e @@ -10,6 +10,8 @@ deferred class inherit WSF_CONTEXT_HANDLER [C] + WSF_ROUTER_MAPPING_FACTORY + feature {WSF_ROUTER} -- Mapping new_mapping (a_tpl: READABLE_STRING_8): WSF_ROUTER_MAPPING diff --git a/library/server/wsf/router/wsf_handler.e b/library/server/wsf/router/wsf_handler.e index 53bd564c..618bfbb5 100644 --- a/library/server/wsf/router/wsf_handler.e +++ b/library/server/wsf/router/wsf_handler.e @@ -17,14 +17,7 @@ feature -- Status report 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: like new_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 do end diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e index 99cbd191..79146f48 100644 --- a/library/server/wsf/router/wsf_router.e +++ b/library/server/wsf/router/wsf_router.e @@ -59,17 +59,17 @@ feature -- Mapping feature -- Mapping handler - handle (a_resource: READABLE_STRING_8; h: WSF_HANDLER) - -- Map the mapping associated to handler `h' for resource `a_resource' + handle (a_resource: READABLE_STRING_8; f: WSF_ROUTER_MAPPING_FACTORY) + -- Map the mapping created by factory `f' for resource `a_resource' do - handle_with_request_methods (a_resource, h, Void) + handle_with_request_methods (a_resource, f, 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' + handle_with_request_methods (a_resource: READABLE_STRING_8; f: WSF_ROUTER_MAPPING_FACTORY; rqst_methods: detachable WSF_ROUTER_METHODS) + -- Map the mapping created by factory `f' for resource `a_resource' -- and only for request methods `rqst_methods' do - map_with_request_methods (h.new_mapping (a_resource), rqst_methods) + map_with_request_methods (f.new_mapping (a_resource), rqst_methods) end feature -- Access @@ -220,6 +220,15 @@ feature -- Request methods helper Result.lock end + methods_get_put_delete: WSF_ROUTER_METHODS + once ("THREAD") + create Result.make (3) + Result.enable_get + Result.enable_put + Result.enable_delete + Result.lock + end + methods_head_get: WSF_ROUTER_METHODS once ("THREAD") create Result.make (2) diff --git a/library/server/wsf/router/wsf_router_mapping_factory.e b/library/server/wsf/router/wsf_router_mapping_factory.e new file mode 100644 index 00000000..3ce06cdf --- /dev/null +++ b/library/server/wsf/router/wsf_router_mapping_factory.e @@ -0,0 +1,32 @@ +note + description: "[ + Component that know how to create a router mapping from request and response. + Usually handler inherits from this classes, this way, it is easy to use WSF_ROUTER.handle_... (resource, handler, ..) + ]" + author: "" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_ROUTER_MAPPING_FACTORY + +feature {WSF_ROUTER} -- Mapping + + new_mapping (a_uri: READABLE_STRING_8): WSF_ROUTER_MAPPING + -- New mapping object + deferred + ensure + Result_attached: Result /= 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 diff --git a/library/server/wsf/src/filter/wsf_filter_context_handler.e b/library/server/wsf/src/filter/wsf_filter_context_handler.e new file mode 100644 index 00000000..c8768a2f --- /dev/null +++ b/library/server/wsf/src/filter/wsf_filter_context_handler.e @@ -0,0 +1,34 @@ +note + description: "Summary description for {WSF_FILTER_CONTEXT_HANDLER}." + author: "" + date: "$Date$" + revision: "$Revision$" + +deferred class + WSF_FILTER_CONTEXT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end, H -> WSF_CONTEXT_HANDLER [C]] + +inherit + WSF_FILTER_HANDLER [H] + + WSF_CONTEXT_HANDLER [C] + +feature {NONE} -- Implementation + + execute_next (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) + do + if attached next as n then + n.execute (ctx, 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