From 17ce1be58204b5e25d9d3c7ff2a05b27572e3a33 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Sat, 24 Nov 2012 11:55:10 +0000 Subject: [PATCH 1/6] Added framework for HTTP-conforming contracts --- .../src/resource/order_handler.e | 36 ++++++------ .../server/wsf/extension/wsf_method_handler.e | 24 ++++++++ .../wsf/extension/wsf_method_handlers.e | 55 +++++++++++++++++++ .../extension/wsf_resource_handler_helper.e | 49 ++++++++++++----- 4 files changed, 129 insertions(+), 35 deletions(-) create mode 100644 library/server/wsf/extension/wsf_method_handler.e create mode 100644 library/server/wsf/extension/wsf_method_handlers.e diff --git a/examples/restbucksCRUD/src/resource/order_handler.e b/examples/restbucksCRUD/src/resource/order_handler.e index 16fba5bd..62287810 100644 --- a/examples/restbucksCRUD/src/resource/order_handler.e +++ b/examples/restbucksCRUD/src/resource/order_handler.e @@ -23,7 +23,7 @@ inherit WSF_RESOURCE_HANDLER_HELPER redefine - do_get, + do_get_head, do_post, do_put, do_delete @@ -53,27 +53,21 @@ feature -- API DOC feature -- HTTP Methods - 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 order - -- 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_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; a_is_get: BOOLEAN) + -- local - id : STRING + id: STRING do - if attached req.orig_path_info as orig_path then + if attached a_req.orig_path_info as orig_path then id := get_order_id_from_path (orig_path) if attached retrieve_order (id) as l_order then - if is_conditional_get (req, l_order) then - handle_resource_not_modified_response ("The resource" + orig_path + "does not change", req, res) + if is_conditional_get (a_req, l_order) then + handle_resource_not_modified_response ("The resource" + orig_path + "does not change", a_req, a_res) else - compute_response_get (req, res, l_order) + compute_response_get_head (a_req, a_res, l_order, a_is_get) end else - handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", req, res) + handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", a_req, a_res) end end end @@ -93,7 +87,7 @@ feature -- HTTP Methods end end - compute_response_get (req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) + compute_response_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; l_order: ORDER; a_is_get: BOOLEAN) local h: HTTP_HEADER l_msg : STRING @@ -105,13 +99,15 @@ feature -- HTTP Methods if attached {JSON_VALUE} json.value (l_order) as jv then l_msg := jv.representation h.put_content_length (l_msg.count) - if attached req.request_time as time then + if attached a_req.request_time as time then h.add_header ("Date:" + time.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT") end h.add_header ("etag:" + etag_utils.md5_digest (l_order.out)) - res.set_status_code ({HTTP_STATUS_CODE}.ok) - res.put_header_text (h.string) - res.put_string (l_msg) + a_res.set_status_code ({HTTP_STATUS_CODE}.ok) + a_res.put_header_text (h.string) + if a_is_get then + a_res.put_string (l_msg) + end end end diff --git a/library/server/wsf/extension/wsf_method_handler.e b/library/server/wsf/extension/wsf_method_handler.e new file mode 100644 index 00000000..8176ebef --- /dev/null +++ b/library/server/wsf/extension/wsf_method_handler.e @@ -0,0 +1,24 @@ +note + + description: "Conforming handler for any HTTP 1.1 standard method" + + author: "Colin Adams" + date: "$Date$" + revision: "$Revision$" + +deferred class WSF_METHOD_HANDLER + +feature -- Method + + do_method (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) + -- Respond to `a_req' using `a_res'. + require + a_req_not_void: a_req /= Void + a_res_not_void: a_res /= Void + deferred + ensure + + end + +end + diff --git a/library/server/wsf/extension/wsf_method_handlers.e b/library/server/wsf/extension/wsf_method_handlers.e new file mode 100644 index 00000000..4552279d --- /dev/null +++ b/library/server/wsf/extension/wsf_method_handlers.e @@ -0,0 +1,55 @@ +note + + description: "Conforming handlers for HTTP 1.1 standard methods" + + author: "Colin Adams" + date: "$Date$" + revision: "$Revision$" + +deferred class WSF_METHOD_HANDLERS + +inherit + + WSF_METHOD_HANDLER + rename + do_method as do_get + select + do_get + end + + WSF_METHOD_HANDLER + rename + do_method as do_put + end + + WSF_METHOD_HANDLER + rename + do_method as do_put + end + + WSF_METHOD_HANDLER + rename + do_method as do_connect + end + + WSF_METHOD_HANDLER + rename + do_method as do_head + end + + WSF_METHOD_HANDLER + rename + do_method as do_options + end + + WSF_METHOD_HANDLER + rename + do_method as do_trace + end + +feature -- Method + + +end + + diff --git a/library/server/wsf/extension/wsf_resource_handler_helper.e b/library/server/wsf/extension/wsf_resource_handler_helper.e index 0f1f0732..6c432b05 100644 --- a/library/server/wsf/extension/wsf_resource_handler_helper.e +++ b/library/server/wsf/extension/wsf_resource_handler_helper.e @@ -4,13 +4,16 @@ note date: "$Date$" revision: "$Revision$" -class - WSF_RESOURCE_HANDLER_HELPER +class WSF_RESOURCE_HANDLER_HELPER + +inherit + + WSF_METHOD_HANDLERS feature -- Execute template 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 m: READABLE_STRING_8 do @@ -44,16 +47,31 @@ feature -- Method Get do_get (req, res) end - do_get (req: WSF_REQUEST; res: WSF_RESPONSE) + frozen 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 SUCCESS, we respond with + -- 200 OK, and a representation of the resource. -- 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) + do_get_head (req, res, True) + end + + do_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; a_is_get: BOOLEAN) + -- Using GET or HEAD to retrieve resource information. + -- If the GET or HEAD request is SUCCESS, we respond with + -- 200 OK, and WITH/WITHOUT (for GET/HEAD respectively) a representation of the resource + -- If the GET or HEAD request is not SUCCESS, we respond with + -- 404 Resource not found. + -- If Conditional GET or HEAD and the resource does not change we send a + -- 304, Resource not modifed. + do + handle_not_implemented ("Methods GET and HEAD not implemented", a_req, a_res) + ensure + all_postconditions_for_do_get: a_is_get implies True + all_postconditions_for_do_head: not a_is_get implies True end feature -- Method Post @@ -139,16 +157,16 @@ feature -- Method HEAD do_head (req, res) end - do_head (req: WSF_REQUEST; res: WSF_RESPONSE) + frozen 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 + -- If the HEAD request is SUCCESS, we respond with + -- 200 OK, and WITHOUT a representation of the resource. + -- If the HEAD request is not SUCCESS, we respond with + -- 404 Resource not found. + -- If Conditional HEAD and the resource does not change we send a + -- 304, Resource not modifed. do - handle_not_implemented ("Method HEAD not implemented", req, res) + do_get_head (req, res, False) end feature -- Method OPTIONS @@ -172,6 +190,7 @@ feature -- Method TRACE do_trace (req: WSF_REQUEST; res: WSF_RESPONSE) do + -- TODO - implement frozen, as there is only one permitted semantic. handle_not_implemented ("Method TRACE not implemented", req, res) end From 496df96f756cafea745c0aa9028f1b52647af5bb Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Sat, 24 Nov 2012 14:02:26 +0000 Subject: [PATCH 2/6] First postconditions relating to response codes added --- .../server/wsf/extension/wsf_method_handler.e | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/library/server/wsf/extension/wsf_method_handler.e b/library/server/wsf/extension/wsf_method_handler.e index 8176ebef..ace5fde8 100644 --- a/library/server/wsf/extension/wsf_method_handler.e +++ b/library/server/wsf/extension/wsf_method_handler.e @@ -17,7 +17,47 @@ feature -- Method a_res_not_void: a_res /= Void deferred ensure + valid_response_for_http_1_0: is_1_0 (a_req.server_protocol) implies + valid_response_for_http_1_0 (a_res.status_code) + empty_body_for_no_content_response: is_no_content_response(a_res.status_code) implies a_res.transfered_content_length = 0 -- Is that the right measure? + end +feature -- Contract support + + is_1_0 (a_protocol: READABLE_STRING_8): BOOLEAN + -- Is `a_protocol' (a variant of) HTTP 1.0? + require + a_protocol_not_void: a_protocol /= Void + do + Result := a_protocol.count >= 8 and then + a_protocol.substring (1, 8) ~ "HTTP/1.0" + end + + valid_response_for_http_1_0 (a_status_code: INTEGER): BOOLEAN + -- Is `a_status_code' a valid response to HTTP 1.0? + do + -- 1XX is forbidden + + -- first approximation + Result := a_status_code >= {HTTP_STATUS_CODE}.ok + end + + is_no_content_response (a_status_code: INTEGER): BOOLEAN + -- Is `a_status_code' one that does not permit an entity in the response? + do + inspect + a_status_code + when {HTTP_STATUS_CODE}.no_content then + Result := True + when {HTTP_STATUS_CODE}.reset_content then + Result := True + when {HTTP_STATUS_CODE}.not_modified then + Result := True + when {HTTP_STATUS_CODE}.conflict then + Result := True + else + -- default to False + end end end From 68cd78d87dad20e1dd70a207aa36492f5d745439 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Sat, 24 Nov 2012 14:13:38 +0000 Subject: [PATCH 3/6] Forced HEAD when GET requested --- library/server/wsf/router/wsf_router.e | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e index dda16aa0..68db1375 100644 --- a/library/server/wsf/router/wsf_router.e +++ b/library/server/wsf/router/wsf_router.e @@ -53,6 +53,9 @@ feature -- Mapping map_with_request_methods (a_mapping: WSF_ROUTER_MAPPING; rqst_methods: detachable WSF_ROUTER_METHODS) -- Map `a_mapping' for request methods `rqst_methods' do + if attached rqst_methods as l_rm and then l_rm.has ("GET") then + l_rm.enable_head + end mappings.extend (create {WSF_ROUTER_ITEM}.make_with_request_methods (a_mapping, rqst_methods)) a_mapping.handler.on_mapped (a_mapping, rqst_methods) end From a9d83f97a8623a22deaaf943b17f4f5a2d957ef9 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Sat, 24 Nov 2012 15:45:42 +0000 Subject: [PATCH 4/6] Completed first pass for HTTP 1.1 conformace contracts --- examples/restbucksCRUD/restbucks-safe.ecf | 8 +++--- .../server/wsf/extension/wsf_method_handler.e | 10 +++++++- .../wsf/extension/wsf_method_handlers.e | 25 ++++++++++++++++++- .../extension/wsf_resource_handler_helper.e | 1 + library/server/wsf/router/wsf_router.e | 2 +- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/examples/restbucksCRUD/restbucks-safe.ecf b/examples/restbucksCRUD/restbucks-safe.ecf index 5e884262..30267388 100644 --- a/examples/restbucksCRUD/restbucks-safe.ecf +++ b/examples/restbucksCRUD/restbucks-safe.ecf @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@ @@ -21,9 +21,9 @@ - + - + diff --git a/library/server/wsf/extension/wsf_method_handler.e b/library/server/wsf/extension/wsf_method_handler.e index ace5fde8..b0eb5743 100644 --- a/library/server/wsf/extension/wsf_method_handler.e +++ b/library/server/wsf/extension/wsf_method_handler.e @@ -19,7 +19,7 @@ feature -- Method ensure valid_response_for_http_1_0: is_1_0 (a_req.server_protocol) implies valid_response_for_http_1_0 (a_res.status_code) - empty_body_for_no_content_response: is_no_content_response(a_res.status_code) implies a_res.transfered_content_length = 0 -- Is that the right measure? + empty_body_for_no_content_response: is_no_content_response (a_res.status_code) implies is_empty_content (a_res) end feature -- Contract support @@ -60,5 +60,13 @@ feature -- Contract support end end + is_empty_content (a_res: WSF_RESPONSE): BOOLEAN + -- Does `a_res' not contain an entity? + require + a_res_not_void: a_res /= Void + do + Result := a_res.transfered_content_length = 0 -- Is that the right measure? + end + end diff --git a/library/server/wsf/extension/wsf_method_handlers.e b/library/server/wsf/extension/wsf_method_handlers.e index 4552279d..7fdae634 100644 --- a/library/server/wsf/extension/wsf_method_handlers.e +++ b/library/server/wsf/extension/wsf_method_handlers.e @@ -49,7 +49,30 @@ inherit feature -- Method - + do_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) + -- Respond to `a_req' using `a_res'. + deferred + ensure then + empty_body: is_empty_content (a_res) + end + + do_post (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) + -- Respond to `a_req' using `a_res'. + deferred + ensure then + non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.created implies + not is_empty_content (a_res) + location_header: a_res.status_code = {HTTP_STATUS_CODE}.created implies True -- WSF_RESPONSE needs enhancing + end + + do_trace (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) + -- Respond to `a_req' using `a_res'. + deferred + ensure then + non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.ok implies + not is_empty_content (a_res) + end + end diff --git a/library/server/wsf/extension/wsf_resource_handler_helper.e b/library/server/wsf/extension/wsf_resource_handler_helper.e index 6c432b05..9e382e24 100644 --- a/library/server/wsf/extension/wsf_resource_handler_helper.e +++ b/library/server/wsf/extension/wsf_resource_handler_helper.e @@ -178,6 +178,7 @@ feature -- Method OPTIONS do_options (req: WSF_REQUEST; res: WSF_RESPONSE) do + -- TODO - implement a default method that lists the accepted methods for the resource. handle_not_implemented ("Method OPTIONS not implemented", req, res) end diff --git a/library/server/wsf/router/wsf_router.e b/library/server/wsf/router/wsf_router.e index 68db1375..bbe24b58 100644 --- a/library/server/wsf/router/wsf_router.e +++ b/library/server/wsf/router/wsf_router.e @@ -53,7 +53,7 @@ feature -- Mapping map_with_request_methods (a_mapping: WSF_ROUTER_MAPPING; rqst_methods: detachable WSF_ROUTER_METHODS) -- Map `a_mapping' for request methods `rqst_methods' do - if attached rqst_methods as l_rm and then l_rm.has ("GET") then + if attached rqst_methods as l_rm and then l_rm.has ({HTTP_REQUEST_METHODS}.method_get) then l_rm.enable_head end mappings.extend (create {WSF_ROUTER_ITEM}.make_with_request_methods (a_mapping, rqst_methods)) From 58f26fdc1be15f75b9677371e997da21e83e1ea4 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Thu, 6 Dec 2012 19:48:13 +0000 Subject: [PATCH 5/6] Revert do_get_head patch --- .../src/resource/order_handler.e | 12 ++++------ .../extension/wsf_resource_handler_helper.e | 23 ++++--------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/examples/restbucksCRUD/src/resource/order_handler.e b/examples/restbucksCRUD/src/resource/order_handler.e index 62287810..dd2422b4 100644 --- a/examples/restbucksCRUD/src/resource/order_handler.e +++ b/examples/restbucksCRUD/src/resource/order_handler.e @@ -23,7 +23,7 @@ inherit WSF_RESOURCE_HANDLER_HELPER redefine - do_get_head, + do_get, do_post, do_put, do_delete @@ -53,7 +53,7 @@ feature -- API DOC feature -- HTTP Methods - do_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; a_is_get: BOOLEAN) + do_get (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) -- local id: STRING @@ -64,7 +64,7 @@ feature -- HTTP Methods if is_conditional_get (a_req, l_order) then handle_resource_not_modified_response ("The resource" + orig_path + "does not change", a_req, a_res) else - compute_response_get_head (a_req, a_res, l_order, a_is_get) + compute_response_get (a_req, a_res, l_order) end else handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", a_req, a_res) @@ -87,7 +87,7 @@ feature -- HTTP Methods end end - compute_response_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; l_order: ORDER; a_is_get: BOOLEAN) + compute_response_get (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; l_order: ORDER) local h: HTTP_HEADER l_msg : STRING @@ -105,9 +105,7 @@ feature -- HTTP Methods h.add_header ("etag:" + etag_utils.md5_digest (l_order.out)) a_res.set_status_code ({HTTP_STATUS_CODE}.ok) a_res.put_header_text (h.string) - if a_is_get then - a_res.put_string (l_msg) - end + a_res.put_string (l_msg) end end diff --git a/library/server/wsf/extension/wsf_resource_handler_helper.e b/library/server/wsf/extension/wsf_resource_handler_helper.e index 9e382e24..dab8cb64 100644 --- a/library/server/wsf/extension/wsf_resource_handler_helper.e +++ b/library/server/wsf/extension/wsf_resource_handler_helper.e @@ -47,7 +47,7 @@ feature -- Method Get do_get (req, res) end - frozen do_get (req: WSF_REQUEST; res: WSF_RESPONSE) + do_get (req: WSF_REQUEST; res: WSF_RESPONSE) -- Using GET to retrieve resource information. -- If the GET request is SUCCESS, we respond with -- 200 OK, and a representation of the resource. @@ -56,22 +56,7 @@ feature -- Method Get -- If is a Condition GET and the resource does not change we send a -- 304, Resource not modifed do - do_get_head (req, res, True) - end - - do_get_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; a_is_get: BOOLEAN) - -- Using GET or HEAD to retrieve resource information. - -- If the GET or HEAD request is SUCCESS, we respond with - -- 200 OK, and WITH/WITHOUT (for GET/HEAD respectively) a representation of the resource - -- If the GET or HEAD request is not SUCCESS, we respond with - -- 404 Resource not found. - -- If Conditional GET or HEAD and the resource does not change we send a - -- 304, Resource not modifed. - do - handle_not_implemented ("Methods GET and HEAD not implemented", a_req, a_res) - ensure - all_postconditions_for_do_get: a_is_get implies True - all_postconditions_for_do_head: not a_is_get implies True + handle_not_implemented ("Method GET not implemented", req, res) end feature -- Method Post @@ -157,7 +142,7 @@ feature -- Method HEAD do_head (req, res) end - frozen do_head (req: WSF_REQUEST; res: WSF_RESPONSE) + do_head (req: WSF_REQUEST; res: WSF_RESPONSE) -- Using HEAD to retrieve resource information. -- If the HEAD request is SUCCESS, we respond with -- 200 OK, and WITHOUT a representation of the resource. @@ -166,7 +151,7 @@ feature -- Method HEAD -- If Conditional HEAD and the resource does not change we send a -- 304, Resource not modifed. do - do_get_head (req, res, False) + handle_not_implemented ("Method HEAD not implemented", req, res) end feature -- Method OPTIONS From eafb04719d767a41528f457b14b08b8f319744a8 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Tue, 11 Dec 2012 19:26:06 +0000 Subject: [PATCH 6/6] Actioned Jocelyns comments re. a_req and a_res --- .../src/resource/order_handler.e | 22 ++++++++--------- .../server/wsf/extension/wsf_method_handler.e | 22 ++++++++--------- .../wsf/extension/wsf_method_handlers.e | 24 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/restbucksCRUD/src/resource/order_handler.e b/examples/restbucksCRUD/src/resource/order_handler.e index dd2422b4..057a3a95 100644 --- a/examples/restbucksCRUD/src/resource/order_handler.e +++ b/examples/restbucksCRUD/src/resource/order_handler.e @@ -53,21 +53,21 @@ feature -- API DOC feature -- HTTP Methods - do_get (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) + do_get (req: WSF_REQUEST; res: WSF_RESPONSE) -- local id: STRING do - if attached a_req.orig_path_info as orig_path then + if attached req.orig_path_info as orig_path then id := get_order_id_from_path (orig_path) if attached retrieve_order (id) as l_order then - if is_conditional_get (a_req, l_order) then - handle_resource_not_modified_response ("The resource" + orig_path + "does not change", a_req, a_res) + if is_conditional_get (req, l_order) then + handle_resource_not_modified_response ("The resource" + orig_path + "does not change", req, res) else - compute_response_get (a_req, a_res, l_order) + compute_response_get (req, res, l_order) end else - handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", a_req, a_res) + handle_resource_not_found_response ("The following resource" + orig_path + " is not found ", req, res) end end end @@ -87,7 +87,7 @@ feature -- HTTP Methods end end - compute_response_get (a_req: WSF_REQUEST; a_res: WSF_RESPONSE; l_order: ORDER) + compute_response_get (req: WSF_REQUEST; res: WSF_RESPONSE; l_order: ORDER) local h: HTTP_HEADER l_msg : STRING @@ -99,13 +99,13 @@ feature -- HTTP Methods if attached {JSON_VALUE} json.value (l_order) as jv then l_msg := jv.representation h.put_content_length (l_msg.count) - if attached a_req.request_time as time then + if attached req.request_time as time then h.add_header ("Date:" + time.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT") end h.add_header ("etag:" + etag_utils.md5_digest (l_order.out)) - a_res.set_status_code ({HTTP_STATUS_CODE}.ok) - a_res.put_header_text (h.string) - a_res.put_string (l_msg) + res.set_status_code ({HTTP_STATUS_CODE}.ok) + res.put_header_text (h.string) + res.put_string (l_msg) end end diff --git a/library/server/wsf/extension/wsf_method_handler.e b/library/server/wsf/extension/wsf_method_handler.e index b0eb5743..0b76e1f6 100644 --- a/library/server/wsf/extension/wsf_method_handler.e +++ b/library/server/wsf/extension/wsf_method_handler.e @@ -10,16 +10,16 @@ deferred class WSF_METHOD_HANDLER feature -- Method - do_method (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) - -- Respond to `a_req' using `a_res'. + do_method (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Respond to `req' using `res'. require - a_req_not_void: a_req /= Void - a_res_not_void: a_res /= Void + req_not_void: req /= Void + res_not_void: res /= Void deferred ensure - valid_response_for_http_1_0: is_1_0 (a_req.server_protocol) implies - valid_response_for_http_1_0 (a_res.status_code) - empty_body_for_no_content_response: is_no_content_response (a_res.status_code) implies is_empty_content (a_res) + valid_response_for_http_1_0: is_1_0 (req.server_protocol) implies + valid_response_for_http_1_0 (res.status_code) + empty_body_for_no_content_response: is_no_content_response (res.status_code) implies is_empty_content (res) end feature -- Contract support @@ -60,12 +60,12 @@ feature -- Contract support end end - is_empty_content (a_res: WSF_RESPONSE): BOOLEAN - -- Does `a_res' not contain an entity? + is_empty_content (res: WSF_RESPONSE): BOOLEAN + -- Does `res' not contain an entity? require - a_res_not_void: a_res /= Void + res_not_void: res /= Void do - Result := a_res.transfered_content_length = 0 -- Is that the right measure? + Result := res.transfered_content_length = 0 -- Is that the right measure? end end diff --git a/library/server/wsf/extension/wsf_method_handlers.e b/library/server/wsf/extension/wsf_method_handlers.e index 7fdae634..06e828c1 100644 --- a/library/server/wsf/extension/wsf_method_handlers.e +++ b/library/server/wsf/extension/wsf_method_handlers.e @@ -49,28 +49,28 @@ inherit feature -- Method - do_head (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) - -- Respond to `a_req' using `a_res'. + do_head (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Respond to `req' using `res'. deferred ensure then - empty_body: is_empty_content (a_res) + empty_body: is_empty_content (res) end - do_post (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) - -- Respond to `a_req' using `a_res'. + do_post (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Respond to `req' using `res'. deferred ensure then - non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.created implies - not is_empty_content (a_res) - location_header: a_res.status_code = {HTTP_STATUS_CODE}.created implies True -- WSF_RESPONSE needs enhancing + non_empty_body: res.status_code = {HTTP_STATUS_CODE}.created implies + not is_empty_content (res) + location_header: res.status_code = {HTTP_STATUS_CODE}.created implies True -- WSF_RESPONSE needs enhancing end - do_trace (a_req: WSF_REQUEST; a_res: WSF_RESPONSE) - -- Respond to `a_req' using `a_res'. + do_trace (req: WSF_REQUEST; res: WSF_RESPONSE) + -- Respond to `req' using `res'. deferred ensure then - non_empty_body: a_res.status_code = {HTTP_STATUS_CODE}.ok implies - not is_empty_content (a_res) + non_empty_body: res.status_code = {HTTP_STATUS_CODE}.ok implies + not is_empty_content (res) end end