From 991389e9b9520a30bc07b382710935b4bb18a87f Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 24 Jan 2014 11:02:43 +0100 Subject: [PATCH] Update restbucksCRUD example to use "crypto" library rather than "eel". Updated readme.md to add curl command to test the server. --- examples/restbucksCRUD/readme.md | 6 +++++- examples/restbucksCRUD/restbucks-safe.ecf | 2 +- .../src/policy_driven_resource/order_handler.e | 3 +-- examples/restbucksCRUD/src/utils/etag_utils.e | 15 +++------------ 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/examples/restbucksCRUD/readme.md b/examples/restbucksCRUD/readme.md index 6d06a051..6b85f132 100644 --- a/examples/restbucksCRUD/readme.md +++ b/examples/restbucksCRUD/readme.md @@ -155,6 +155,9 @@ Response success } ] } +note: + curl -vv http://localhost:9090/order -H "Content-Type: application/json" -d "{\"location\":\"takeAway\",\"items\":[{\"name\":\"Late\",\"option\":\"skim\",\"size\":\"Small\",\"quantity\":1}]}" -X POST + How to Read an order with GET ----------------------------- @@ -192,7 +195,8 @@ Response } ] } - +note: + curl -vv http://localhost:9090/order/1 How to Update an order with PUT ------------------------------- diff --git a/examples/restbucksCRUD/restbucks-safe.ecf b/examples/restbucksCRUD/restbucks-safe.ecf index 3f46e7a9..735a2e52 100644 --- a/examples/restbucksCRUD/restbucks-safe.ecf +++ b/examples/restbucksCRUD/restbucks-safe.ecf @@ -15,7 +15,7 @@ - + diff --git a/examples/restbucksCRUD/src/policy_driven_resource/order_handler.e b/examples/restbucksCRUD/src/policy_driven_resource/order_handler.e index e8470668..f20881fe 100644 --- a/examples/restbucksCRUD/src/policy_driven_resource/order_handler.e +++ b/examples/restbucksCRUD/src/policy_driven_resource/order_handler.e @@ -227,8 +227,7 @@ feature -- Execution end end ensure then - order_saved_only_for_get_head: req.is_get_head_request_method = - attached {ORDER} req.execution_variable (Order_execution_variable) + order_saved_only_for_get_head: attached {ORDER} req.execution_variable (Order_execution_variable) implies req.is_get_head_request_method end feature -- GET/HEAD content diff --git a/examples/restbucksCRUD/src/utils/etag_utils.e b/examples/restbucksCRUD/src/utils/etag_utils.e index 99b6113a..9aed6c1d 100644 --- a/examples/restbucksCRUD/src/utils/etag_utils.e +++ b/examples/restbucksCRUD/src/utils/etag_utils.e @@ -6,28 +6,19 @@ note class ETAG_UTILS -inherit - ARRAY_FACILITIES - feature -- Access md5_digest (a_string: STRING): STRING -- Cryptographic hash function that produces a 128-bit (16-byte) hash value, based on `a_string' local md5: MD5 - output: SPECIAL [NATURAL_8] do create md5.make - create output.make_filled (0, 16) - md5.sink_string (a_string) - md5.do_final (output, 0) - Result := as_natural_32_be (output, 0).to_hex_string - Result.append (as_natural_32_be (output, 4).to_hex_string) - Result.append (as_natural_32_be (output, 8).to_hex_string) - Result.append (as_natural_32_be (output, 12).to_hex_string) + md5.update_from_string (a_string) + Result := md5.digest_as_string end note - copyright: "2011-2012, Javier Velilla and others" + copyright: "2011-2014, Javier Velilla and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end