Update Restbucks example: Conditional GET, PUT.

Added a response method to support resource not
modified.
Added a ETAG_UTILS class to calcule md5_digest.
Added ext libs eel and eapml.
This commit is contained in:
jvelilla
2011-10-21 08:26:14 -03:00
parent 8255dfd996
commit 9f53287226
5 changed files with 105 additions and 5 deletions

View File

@@ -182,6 +182,25 @@ feature -- Handle responses
res.write_string (a_description)
end
handle_precondition_fail_response (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER )
local
h : EWF_HEADER
do
create h.make
h.put_status ({HTTP_STATUS_CODE}.precondition_failed)
if attached ctx.request_content_type (supported_content_types) as l_content_type then
h.put_content_type (l_content_type)
else
h.put_content_type ("*/*")
end
h.put_content_length (a_description.count)
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.precondition_failed)
res.write_headers_string (h.string)
res.write_string (a_description)
end
handle_internal_server_error (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER )
local
h : EWF_HEADER
@@ -239,6 +258,26 @@ feature -- Handle responses
end
handle_resource_not_modified_response (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
local
h : EWF_HEADER
do
res.flush
create h.make
h.put_status ({HTTP_STATUS_CODE}.not_modified)
if attached ctx.request_content_type (supported_content_types) as l_content_type then
h.put_content_type (l_content_type)
else
h.put_content_type ("*/*")
end
h.put_content_length (a_description.count)
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.not_modified)
res.write_headers_string (h.string)
res.write_string (a_description)
end
handle_resource_conflict_response (a_description:STRING; ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
local
h : EWF_HEADER