From 58f26fdc1be15f75b9677371e997da21e83e1ea4 Mon Sep 17 00:00:00 2001 From: Colin Adams Date: Thu, 6 Dec 2012 19:48:13 +0000 Subject: [PATCH] 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