From aa743c0a7d24c8c0b1dd8e4866a103802e31a55e Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 8 Oct 2012 10:40:44 +0200 Subject: [PATCH] Removed generic parameter in WSF_FILTER_HANDLER, since it is useless and make code heavy Signed-off-by: Olivier Ligot Signed-off-by: Jocelyn Fiat --- examples/filter/src/database/database_api.e | 25 +++ .../filter/src/filter/authentication_filter.e | 10 +- examples/filter/src/resource/user_handler.e | 2 +- .../wsf_resource_context_handler_helper.e | 93 ++++++++- .../extension/wsf_resource_handler_helper.e | 177 ++++++++---------- .../context}/wsf_filter_context_handler.e | 12 +- .../wsf/{src => router}/filter/README.md | 0 .../wsf/{src => router}/filter/wsf_filter.e | 0 .../filter/wsf_filter_handler.e | 4 +- .../filter/wsf_filtered_service.e | 0 .../filter/wsf_routing_filter.e | 0 .../helpers/wsf_starts_with_filter_handler.e | 42 +++++ .../uri/helpers/wsf_uri_filter_handler.e} | 12 +- .../wsf_uri_template_filter_handler.e} | 12 +- .../wsf_uri_template_filter_context_handler.e | 42 +++++ 15 files changed, 313 insertions(+), 118 deletions(-) rename library/server/wsf/{src/filter => router/context}/wsf_filter_context_handler.e (85%) rename library/server/wsf/{src => router}/filter/README.md (100%) rename library/server/wsf/{src => router}/filter/wsf_filter.e (100%) rename library/server/wsf/{src => router}/filter/wsf_filter_handler.e (93%) rename library/server/wsf/{src => router}/filter/wsf_filtered_service.e (100%) rename library/server/wsf/{src => router}/filter/wsf_routing_filter.e (100%) create mode 100644 library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e rename library/server/wsf/{src/filter/wsf_filter_uri_handler.e => router/support/uri/helpers/wsf_uri_filter_handler.e} (82%) rename library/server/wsf/{src/filter/wsf_filter_uri_template_handler.e => router/support/uri_template/helpers/wsf_uri_template_filter_handler.e} (81%) create mode 100644 library/server/wsf/router/support/uri_template_with_context/helpers/wsf_uri_template_filter_context_handler.e diff --git a/examples/filter/src/database/database_api.e b/examples/filter/src/database/database_api.e index 2eb23793..4c0024c0 100644 --- a/examples/filter/src/database/database_api.e +++ b/examples/filter/src/database/database_api.e @@ -24,6 +24,31 @@ feature -- Initialization feature -- Access + user (a_id: INTEGER; a_name: detachable READABLE_STRING_GENERAL): detachable USER + -- User with id `a_id' or name `a_name'. + require + a_id > 0 xor a_name /= Void + local + n: like {USER}.name + do + if a_id > 0 then + Result := users.item (a_id) + elseif a_name /= Void then + n := a_name.as_string_8 + across + users as c + until + Result /= Void + loop + if attached c.item as u and then u.name.same_string (n) then + Result := u + end + end + end + ensure + Result /= Void implies ((a_id > 0 and then Result.id = a_id) xor (a_name /= Void and then Result.name.same_string_general (a_name))) + end + users: HASH_TABLE [USER, INTEGER] ;note diff --git a/examples/filter/src/filter/authentication_filter.e b/examples/filter/src/filter/authentication_filter.e index 44c27d2e..9b407c7b 100644 --- a/examples/filter/src/filter/authentication_filter.e +++ b/examples/filter/src/filter/authentication_filter.e @@ -8,7 +8,7 @@ class AUTHENTICATION_FILTER inherit - WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT, WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]] + WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT] WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT] @@ -25,9 +25,11 @@ feature -- Basic operations do create l_auth.make (req.http_authorization) if (attached l_auth.type as l_auth_type and then l_auth_type.is_equal ("basic")) and - 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) - and attached l_auth.password as l_auth_password and then l_auth_password.is_equal (l_user.password)) + attached l_auth.login as l_auth_login and then + attached Db_access.user (0, l_auth_login) as l_user and then + l_auth_login.same_string (l_user.name) and then + attached l_auth.password as l_auth_password and then + l_auth_password.same_string (l_user.password) then ctx.set_user (l_user) execute_next (ctx, req, res) diff --git a/examples/filter/src/resource/user_handler.e b/examples/filter/src/resource/user_handler.e index e834b28f..223e93d5 100644 --- a/examples/filter/src/resource/user_handler.e +++ b/examples/filter/src/resource/user_handler.e @@ -8,7 +8,7 @@ class USER_HANDLER inherit - WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT, WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT]] + WSF_FILTER_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT] WSF_URI_TEMPLATE_CONTEXT_HANDLER [FILTER_HANDLER_CONTEXT] diff --git a/library/server/wsf/extension/wsf_resource_context_handler_helper.e b/library/server/wsf/extension/wsf_resource_context_handler_helper.e index 20a50fe3..760a1f2d 100644 --- a/library/server/wsf/extension/wsf_resource_context_handler_helper.e +++ b/library/server/wsf/extension/wsf_resource_context_handler_helper.e @@ -23,17 +23,21 @@ feature -- Basic operations execute_delete (ctx, req, res) elseif m.same_string ({HTTP_REQUEST_METHODS}.method_post) then execute_post (ctx, req, res) + elseif m.same_string ({HTTP_REQUEST_METHODS}.method_trace) then + execute_trace (ctx, req, res) elseif m.same_string ({HTTP_REQUEST_METHODS}.method_options) then execute_options (ctx, req, res) elseif m.same_string ({HTTP_REQUEST_METHODS}.method_head) then execute_head (ctx, req, res) + elseif m.same_string ({HTTP_REQUEST_METHODS}.method_connect) then + execute_connect (ctx, req, res) else --| Eventually handle other methods... execute_extension_method (ctx, req, res) end end -feature {NONE} -- Implementation +feature -- Method Get execute_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do @@ -52,6 +56,8 @@ feature {NONE} -- Implementation handle_not_implemented ("Method GET not implemented", req, res) end +feature -- Method Post + execute_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do if req.is_chunked_input then @@ -78,6 +84,8 @@ feature {NONE} -- Implementation handle_not_implemented ("Method POST not implemented", req, res) end +feature-- Method Put + execute_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do if req.is_chunked_input then @@ -96,20 +104,36 @@ feature {NONE} -- Implementation handle_not_implemented ("Method PUT not implemented", req, res) end +feature -- Method DELETE + execute_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do do_delete (ctx, req, res) end do_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) - -- Here we use DELETE to logically delete a person. - -- 204 if is ok - -- 404 Resource not found - -- 500 if we have an internal server error + -- Here we use DELETE to logically delete a person. + -- 204 if is ok + -- 404 Resource not found + -- 500 if we have an internal server error do handle_not_implemented ("Method DELETE not implemented", req, res) end +feature -- Method CONNECT + + execute_connect (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) + do + do_connect (ctx, req, res) + end + + do_connect (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_not_implemented ("Method CONNECT not implemented", req, res) + end + +feature -- Method HEAD + execute_head (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do do_head (ctx, req, res) @@ -127,6 +151,8 @@ feature {NONE} -- Implementation handle_not_implemented ("Method HEAD not implemented", req, res) end +feature -- Method OPTIONS + execute_options (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do do_options (ctx, req, res) @@ -139,6 +165,20 @@ feature {NONE} -- Implementation handle_not_implemented ("Method OPTIONS not implemented", req, res) end +feature -- Method TRACE + + execute_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) + do + do_trace (ctx, req, res) + end + + do_trace (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_not_implemented ("Method TRACE not implemented", req, res) + end + +feature -- Method Extension Method + execute_extension_method (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) do do_extension_method (ctx, req, res) @@ -149,13 +189,25 @@ feature {NONE} -- Implementation handle_not_implemented ("Method extension-method not implemented", req, res) end +feature -- Handle responses + -- TODO Handle Content negotiation. + -- The option : Server-driven negotiation: uses request headers to select a variant + -- More info : http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12 + +-- supported_content_types: detachable ARRAY [READABLE_STRING_8] +-- -- Supported content types +-- -- Can be redefined +-- do +-- Result := Void +-- end + handle_error (a_description: STRING; a_status_code: INTEGER; req: WSF_REQUEST; res: WSF_RESPONSE) -- Handle an error. local h: HTTP_HEADER do create h.make - h.put_content_type_application_json + h.put_content_type_text_plain h.put_content_length (a_description.count) h.put_current_date res.set_status_code (a_status_code) @@ -184,8 +236,35 @@ feature {NONE} -- Implementation handle_error (a_description, {HTTP_STATUS_CODE}.forbidden, req, res) end +feature -- Handle responses: others + + handle_precondition_fail_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) + do + handle_error (a_description, {HTTP_STATUS_CODE}.precondition_failed, req, res) + end + + handle_internal_server_error (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) + do + handle_error (a_description, {HTTP_STATUS_CODE}.internal_server_error, req, res) + end + + handle_method_not_allowed_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_error (a_description, {HTTP_STATUS_CODE}.method_not_allowed, req, res) + end + + handle_resource_not_modified_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_error (a_description, {HTTP_STATUS_CODE}.not_modified, req, res) + end + + handle_resource_conflict_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_error (a_description, {HTTP_STATUS_CODE}.conflict, req, res) + end + note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/extension/wsf_resource_handler_helper.e b/library/server/wsf/extension/wsf_resource_handler_helper.e index eef2ba1e..cecedca0 100644 --- a/library/server/wsf/extension/wsf_resource_handler_helper.e +++ b/library/server/wsf/extension/wsf_resource_handler_helper.e @@ -37,6 +37,25 @@ feature -- Execute template end end +feature -- Method Get + + execute_get (req: WSF_REQUEST; res: WSF_RESPONSE) + do + do_get (req, res) + end + + do_get (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Using GET to retrieve resource information. + -- If the GET request is SUCCESS, we response with + -- 200 OK, and a representation of the person + -- If the GET request is not SUCCESS, we response with + -- 404 Resource not found + -- If is a Condition GET and the resource does not change we send a + -- 304, Resource not modifed + do + handle_not_implemented ("Method GET not implemented", req, res) + end + feature -- Method Post execute_post (req: WSF_REQUEST; res: WSF_RESPONSE) @@ -53,6 +72,14 @@ feature -- Method Post end do_post (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Here the convention is the following. + -- POST is used for creation and the server determines the URI + -- of the created resource. + -- If the request post is SUCCESS, the server will create the order and will response with + -- HTTP_RESPONSE 201 CREATED, the Location header will contains the newly created order's URI + -- if the request post is not SUCCESS, the server will response with + -- HTTP_RESPONSE 400 BAD REQUEST, the client send a bad request + -- HTTP_RESPONSE 500 INTERNAL_SERVER_ERROR, when the server can deliver the request do handle_not_implemented ("Method POST not implemented", req, res) end @@ -77,18 +104,6 @@ feature-- Method Put handle_not_implemented ("Method PUT not implemented", req, res) end -feature -- Method Get - - execute_get (req: WSF_REQUEST; res: WSF_RESPONSE) - do - do_get (req, res) - end - - do_get (req: WSF_REQUEST; res: WSF_RESPONSE) - do - handle_not_implemented ("Method GET not implemented", req, res) - end - feature -- Method DELETE execute_delete (req: WSF_REQUEST; res: WSF_RESPONSE) @@ -97,6 +112,10 @@ feature -- Method DELETE end do_delete (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Here we use DELETE to logically delete a person. + -- 204 if is ok + -- 404 Resource not found + -- 500 if we have an internal server error do handle_not_implemented ("Method DELETE not implemented", req, res) end @@ -121,6 +140,13 @@ feature -- Method HEAD end do_head (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Using HEAD to retrieve resource information. + -- If the HEAD request is SUCCESS, we response with + -- 200 OK, and WITHOUT a representation of the person + -- If the HEAD request is not SUCCESS, we response with + -- 404 Resource not found + -- If is a Condition HEAD and the resource does not change we send a + -- 304, Resource not modifed do handle_not_implemented ("Method HEAD not implemented", req, res) end @@ -201,122 +227,77 @@ feature -- Handle responses -- The option : Server-driven negotiation: uses request headers to select a variant -- More info : http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12 - supported_content_types: detachable ARRAY [READABLE_STRING_8] - -- Supported content types - -- Can be redefined - do - Result := Void - end +-- supported_content_types: detachable ARRAY [READABLE_STRING_8] +-- -- Supported content types +-- -- Can be redefined +-- do +-- Result := Void +-- end - handle_bad_request_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) + handle_error (a_description: STRING; a_status_code: INTEGER; req: WSF_REQUEST; res: WSF_RESPONSE) + -- Handle an error. local - h : HTTP_HEADER + h: HTTP_HEADER do create h.make - h.put_content_type_application_json + h.put_content_type_text_plain h.put_content_length (a_description.count) h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.bad_request) + res.set_status_code (a_status_code) res.put_header_text (h.string) res.put_string (a_description) end - handle_precondition_fail_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) - local - h : HTTP_HEADER + handle_not_implemented (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.precondition_failed) - res.put_header_text (h.string) - res.put_string (a_description) + handle_error (a_description, {HTTP_STATUS_CODE}.not_implemented, req, res) end - handle_internal_server_error (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) - local - h : HTTP_HEADER + handle_bad_request_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error) - res.put_header_text (h.string) - res.put_string (a_description) - end - - handle_not_implemented (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) - local - h : HTTP_HEADER - do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.not_implemented) - res.put_header_text (h.string) - res.put_string (a_description) - end - - handle_method_not_allowed_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) - local - h : HTTP_HEADER - do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.method_not_allowed) - res.put_header_text (h.string) - res.put_string (a_description) + handle_error (a_description, {HTTP_STATUS_CODE}.bad_request, req, res) end handle_resource_not_found_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) - local - h : HTTP_HEADER do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.not_found) - res.put_header_text (h.string) - res.put_string (a_description) + handle_error (a_description, {HTTP_STATUS_CODE}.not_found, req, res) end + handle_forbidden (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) + -- Handle forbidden. + do + handle_error (a_description, {HTTP_STATUS_CODE}.forbidden, req, res) + end + +feature -- Handle responses: others + + handle_precondition_fail_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) + do + handle_error (a_description, {HTTP_STATUS_CODE}.precondition_failed, req, res) + end + + handle_internal_server_error (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE ) + do + handle_error (a_description, {HTTP_STATUS_CODE}.internal_server_error, req, res) + end + + handle_method_not_allowed_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) + do + handle_error (a_description, {HTTP_STATUS_CODE}.method_not_allowed, req, res) + end handle_resource_not_modified_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) - local - h : HTTP_HEADER do - res.flush - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.not_modified) - res.put_header_text (h.string) - res.put_string (a_description) + handle_error (a_description, {HTTP_STATUS_CODE}.not_modified, req, res) end - handle_resource_conflict_response (a_description: STRING; req: WSF_REQUEST; res: WSF_RESPONSE) - local - h : HTTP_HEADER do - create h.make - h.put_content_type_application_json - h.put_content_length (a_description.count) - h.put_current_date - res.set_status_code ({HTTP_STATUS_CODE}.conflict) - res.put_header_text (h.string) - res.put_string (a_description) + handle_error (a_description, {HTTP_STATUS_CODE}.conflict, req, res) end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/wsf/src/filter/wsf_filter_context_handler.e b/library/server/wsf/router/context/wsf_filter_context_handler.e similarity index 85% rename from library/server/wsf/src/filter/wsf_filter_context_handler.e rename to library/server/wsf/router/context/wsf_filter_context_handler.e index 2b60934f..761d509f 100644 --- a/library/server/wsf/src/filter/wsf_filter_context_handler.e +++ b/library/server/wsf/router/context/wsf_filter_context_handler.e @@ -5,13 +5,21 @@ note revision: "$Revision$" deferred class - WSF_FILTER_CONTEXT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end, H -> WSF_CONTEXT_HANDLER [C]] + WSF_FILTER_CONTEXT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end] inherit - WSF_FILTER_HANDLER [H] + WSF_FILTER_HANDLER + redefine + next + end WSF_CONTEXT_HANDLER [C] +feature -- Access + + next: detachable WSF_CONTEXT_HANDLER [C] + -- Next handler + feature {NONE} -- Implementation execute_next (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/src/filter/README.md b/library/server/wsf/router/filter/README.md similarity index 100% rename from library/server/wsf/src/filter/README.md rename to library/server/wsf/router/filter/README.md diff --git a/library/server/wsf/src/filter/wsf_filter.e b/library/server/wsf/router/filter/wsf_filter.e similarity index 100% rename from library/server/wsf/src/filter/wsf_filter.e rename to library/server/wsf/router/filter/wsf_filter.e diff --git a/library/server/wsf/src/filter/wsf_filter_handler.e b/library/server/wsf/router/filter/wsf_filter_handler.e similarity index 93% rename from library/server/wsf/src/filter/wsf_filter_handler.e rename to library/server/wsf/router/filter/wsf_filter_handler.e index 57e269c1..7fc63ca1 100644 --- a/library/server/wsf/src/filter/wsf_filter_handler.e +++ b/library/server/wsf/router/filter/wsf_filter_handler.e @@ -8,14 +8,14 @@ note revision: "$Revision$" deferred class - WSF_FILTER_HANDLER [H -> WSF_HANDLER] + WSF_FILTER_HANDLER inherit WSF_HANDLER feature -- Access - next: detachable H + next: detachable WSF_HANDLER -- Next handler feature -- Element change diff --git a/library/server/wsf/src/filter/wsf_filtered_service.e b/library/server/wsf/router/filter/wsf_filtered_service.e similarity index 100% rename from library/server/wsf/src/filter/wsf_filtered_service.e rename to library/server/wsf/router/filter/wsf_filtered_service.e diff --git a/library/server/wsf/src/filter/wsf_routing_filter.e b/library/server/wsf/router/filter/wsf_routing_filter.e similarity index 100% rename from library/server/wsf/src/filter/wsf_routing_filter.e rename to library/server/wsf/router/filter/wsf_routing_filter.e diff --git a/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e new file mode 100644 index 00000000..fe3c15c8 --- /dev/null +++ b/library/server/wsf/router/support/starts_with/helpers/wsf_starts_with_filter_handler.e @@ -0,0 +1,42 @@ +note + description : "Objects that ..." + author : "$Author$" + date : "$Date$" + revision : "$Revision$" + +deferred class + WSF_STARTS_WITH_FILTER_HANDLER + +inherit + WSF_FILTER_HANDLER + redefine + next + end + + WSF_STARTS_WITH_HANDLER + +feature -- Access + + next: detachable WSF_STARTS_WITH_FILTER_HANDLER + -- Next handler + +feature -- Execution + + execute_next (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE) + do + if attached next as n then + n.execute (a_start_path, req, res) + end + end + +note + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end diff --git a/library/server/wsf/src/filter/wsf_filter_uri_handler.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e similarity index 82% rename from library/server/wsf/src/filter/wsf_filter_uri_handler.e rename to library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e index 52777e3a..79ae3970 100644 --- a/library/server/wsf/src/filter/wsf_filter_uri_handler.e +++ b/library/server/wsf/router/support/uri/helpers/wsf_uri_filter_handler.e @@ -5,13 +5,21 @@ note revision : "$Revision$" deferred class - WSF_FILTER_URI_HANDLER + WSF_URI_FILTER_HANDLER inherit - WSF_FILTER_HANDLER [WSF_URI_HANDLER] + WSF_FILTER_HANDLER + redefine + next + end WSF_URI_HANDLER +feature -- Access + + next: detachable WSF_URI_FILTER_HANDLER + -- Next handler + feature -- Execution execute_next (req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/src/filter/wsf_filter_uri_template_handler.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e similarity index 81% rename from library/server/wsf/src/filter/wsf_filter_uri_template_handler.e rename to library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e index 463503eb..e6a1d02a 100644 --- a/library/server/wsf/src/filter/wsf_filter_uri_template_handler.e +++ b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_filter_handler.e @@ -5,13 +5,21 @@ note revision : "$Revision$" deferred class - WSF_FILTER_URI_TEMPLATE_HANDLER + WSF_URI_TEMPLATE_FILTER_HANDLER inherit - WSF_FILTER_HANDLER [WSF_URI_TEMPLATE_HANDLER] + WSF_FILTER_HANDLER + redefine + next + end WSF_URI_TEMPLATE_HANDLER +feature -- Access + + next: detachable WSF_URI_TEMPLATE_HANDLER + -- Next handler + feature -- Execution execute_next (req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/router/support/uri_template_with_context/helpers/wsf_uri_template_filter_context_handler.e b/library/server/wsf/router/support/uri_template_with_context/helpers/wsf_uri_template_filter_context_handler.e new file mode 100644 index 00000000..b6346fd6 --- /dev/null +++ b/library/server/wsf/router/support/uri_template_with_context/helpers/wsf_uri_template_filter_context_handler.e @@ -0,0 +1,42 @@ +note + description : "Objects that ..." + author : "$Author$" + date : "$Date$" + revision : "$Revision$" + +deferred class + WSF_URI_TEMPLATE_FILTER_CONTEXT_HANDLER [C -> WSF_HANDLER_CONTEXT create make end] + +inherit + WSF_FILTER_HANDLER + redefine + next + end + + WSF_URI_TEMPLATE_CONTEXT_HANDLER [C] + +feature -- Access + + next: detachable WSF_URI_TEMPLATE_CONTEXT_HANDLER [C] + -- Next handler + +feature -- Execution + + 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, Olivier Ligot, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" + source: "[ + Eiffel Software + 5949 Hollister Ave., Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" +end