Further use of constants for execution variables

This commit is contained in:
Colin Adams
2013-08-14 09:22:35 +01:00
parent c93e50a7e2
commit 275c26b55b
6 changed files with 83 additions and 58 deletions

View File

@@ -28,6 +28,18 @@ create
make_with_router make_with_router
feature -- Execution variables
Order_execution_variable: STRING = "ORDER"
-- Execution variable used by application
Generated_content_execution_variable: STRING = "GENERATED_CONTENT"
-- Execution variable used by application
Extracted_order_execution_variable: STRING = "EXTRACTED_ORDER"
-- Execution variable used by application
feature -- Documentation feature -- Documentation
description: READABLE_STRING_GENERAL description: READABLE_STRING_GENERAL
@@ -87,13 +99,6 @@ feature -- Access
Result.compare_objects Result.compare_objects
end end
previous_location (req: WSF_REQUEST): LIST [URI]
-- Previous location(s) for resource named by `req';
do
-- precondition is never met but we need a non-void Result to satisfy the compiler in Void-safe mode:
create {LINKED_LIST [URI]} Result.make
end
age (req: WSF_REQUEST): NATURAL age (req: WSF_REQUEST): NATURAL
-- Maximum age in seconds before response to `req` is considered stale; -- Maximum age in seconds before response to `req` is considered stale;
-- This is used to generate a Cache-Control: max-age header. -- This is used to generate a Cache-Control: max-age header.
@@ -158,7 +163,7 @@ feature -- Access
l_etag_utils: ETAG_UTILS l_etag_utils: ETAG_UTILS
do do
create l_etag_utils create l_etag_utils
if attached {ORDER} req.execution_variable ("ORDER") as l_order then if attached {ORDER} req.execution_variable (Order_execution_variable) as l_order then
Result := l_etag_utils.md5_digest (l_order.out) Result := l_etag_utils.md5_digest (l_order.out)
end end
end end
@@ -175,7 +180,7 @@ feature -- Measurement
content_length (req: WSF_REQUEST): NATURAL content_length (req: WSF_REQUEST): NATURAL
-- Length of entity-body of the response to `req' -- Length of entity-body of the response to `req'
do do
check attached {READABLE_STRING_8} req.execution_variable ("GENERATED_CONTENT") as l_response then check attached {READABLE_STRING_8} req.execution_variable (Generated_content_execution_variable) as l_response then
-- postcondition generated_content_set_for_get_head of `ensure_content_available' -- postcondition generated_content_set_for_get_head of `ensure_content_available'
-- We only call this for GET/HEAD in this example. -- We only call this for GET/HEAD in this example.
Result := l_response.count.as_natural_32 Result := l_response.count.as_natural_32
@@ -201,7 +206,7 @@ feature -- Execution
check_resource_exists (req: WSF_REQUEST; a_helper: WSF_METHOD_HELPER) check_resource_exists (req: WSF_REQUEST; a_helper: WSF_METHOD_HELPER)
-- Call `a_helper.set_resource_exists' to indicate that `req.path_translated' -- Call `a_helper.set_resource_exists' to indicate that `req.path_translated'
-- is the name of an existing resource. -- is the name of an existing resource.
-- We also put the order into `req.execution_variable ("ORDER")' for GET or HEAD responses. -- We also put the order into `req.execution_variable (Order_execution_variable)' for GET or HEAD responses.
local local
l_id: STRING l_id: STRING
do do
@@ -216,14 +221,14 @@ feature -- Execution
if req.is_get_head_request_method then if req.is_get_head_request_method then
check attached db_access.orders.item (l_id) as l_order then check attached db_access.orders.item (l_id) as l_order then
-- postcondition `item_if_found' of `has_key' -- postcondition `item_if_found' of `has_key'
req.set_execution_variable ("ORDER", l_order) req.set_execution_variable (Order_execution_variable, l_order)
end end
end end
end end
end end
ensure then ensure then
order_saved_only_for_get_head: req.is_get_head_request_method = order_saved_only_for_get_head: req.is_get_head_request_method =
attached {ORDER} req.execution_variable ("ORDER") attached {ORDER} req.execution_variable (Order_execution_variable)
end end
feature -- GET/HEAD content feature -- GET/HEAD content
@@ -234,27 +239,27 @@ feature -- GET/HEAD content
-- for a subsequent call to `content'. -- for a subsequent call to `content'.
-- If chunked, only the first chunk will be made available to `next_chunk'. If chunk extensions -- If chunked, only the first chunk will be made available to `next_chunk'. If chunk extensions
-- are used, then this will also generate the chunk extension for the first chunk. -- are used, then this will also generate the chunk extension for the first chunk.
-- We save the text in `req.execution_variable ("GENERATED_CONTENT")' -- We save the text in `req.execution_variable (Generated_content_execution_variable)'
-- We ignore the results of content negotiation, as there is only one possible combination. -- We ignore the results of content negotiation, as there is only one possible combination.
do do
check attached {ORDER} req.execution_variable ("ORDER") as l_order then check attached {ORDER} req.execution_variable (Order_execution_variable) as l_order then
-- precondition get_or_head and postcondition order_saved_only_for_get_head of `check_resource_exists' and -- precondition get_or_head and postcondition order_saved_only_for_get_head of `check_resource_exists' and
if attached {JSON_VALUE} json.value (l_order) as jv then if attached {JSON_VALUE} json.value (l_order) as jv then
req.set_execution_variable ("GENERATED_CONTENT", jv.representation) req.set_execution_variable (Generated_content_execution_variable, jv.representation)
else else
req.set_execution_variable ("GENERATED_CONTENT", "") req.set_execution_variable (Generated_content_execution_variable, "")
end end
end end
ensure then ensure then
generated_content_set_for_get_head: req.is_get_head_request_method implies generated_content_set_for_get_head: req.is_get_head_request_method implies
attached {READABLE_STRING_8} req.execution_variable ("GENERATED_CONTENT") attached {READABLE_STRING_8} req.execution_variable (Generated_content_execution_variable)
end end
content (req: WSF_REQUEST): READABLE_STRING_8 content (req: WSF_REQUEST): READABLE_STRING_8
-- Non-chunked entity body in response to `req'; -- Non-chunked entity body in response to `req';
-- We only call this for GET/HEAD in this example. -- We only call this for GET/HEAD in this example.
do do
check attached {READABLE_STRING_8} req.execution_variable ("GENERATED_CONTENT") as l_response then check attached {READABLE_STRING_8} req.execution_variable (Generated_content_execution_variable) as l_response then
-- postcondition generated_content_set_for_get_head of `ensure_content_available' -- postcondition generated_content_set_for_get_head of `ensure_content_available'
Result := l_response Result := l_response
end end
@@ -307,14 +312,14 @@ feature -- DELETE
feature -- PUT/POST feature -- PUT/POST
is_entity_too_large (req: WSF_REQUEST): BOOLEAN is_entity_too_large (req: WSF_REQUEST): BOOLEAN
-- Is the entity stored in `req.execution_variable ("REQUEST_ENTITY")' too large for the application? -- Is the entity stored in `req.execution_variable (Request_entity_execution_variable)' too large for the application?
do do
-- No. We don't care for this example. -- No. We don't care for this example.
end end
check_content_headers (req: WSF_REQUEST) check_content_headers (req: WSF_REQUEST)
-- Check we can support all content headers on request entity. -- Check we can support all content headers on request entity.
-- Set `req.execution_variable ("CONTENT_CHECK_CODE")' to {NATURAL} zero if OK, or 415 or 501 if not. -- Set `req.execution_variable (Content_check_code_execution_variable)' to {NATURAL} zero if OK, or 415 or 501 if not.
do do
-- We don't bother for this example. Note that this is equivalent to setting zero. -- We don't bother for this example. Note that this is equivalent to setting zero.
end end
@@ -331,7 +336,7 @@ feature -- PUT/POST
-- Create new resource in response to a POST request. -- Create new resource in response to a POST request.
-- Implementor must set error code of 200 OK or 204 No Content or 303 See Other or 500 Server Error. -- Implementor must set error code of 200 OK or 204 No Content or 303 See Other or 500 Server Error.
do do
if attached {ORDER} req.execution_variable ("EXTRACTED_ORDER") as l_order then if attached {ORDER} req.execution_variable (Extracted_order_execution_variable) as l_order then
save_order (l_order) save_order (l_order)
compute_response_post (req, res, l_order) compute_response_post (req, res, l_order)
else else
@@ -341,16 +346,16 @@ feature -- PUT/POST
check_conflict (req: WSF_REQUEST; res: WSF_RESPONSE) check_conflict (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Check we can support all content headers on request entity. -- Check we can support all content headers on request entity.
-- Set `req.execution_variable ("CONFLICT_CHECK_CODE")' to {NATURAL} zero if OK, or 409 if not. -- Set `req.execution_variable (Conflict_check_code_execution_variable)' to {NATURAL} zero if OK, or 409 if not.
-- In the latter case, write the full error response to `res'. -- In the latter case, write the full error response to `res'.
do do
if attached {ORDER} req.execution_variable ("EXTRACTED_ORDER") as l_order then if attached {ORDER} req.execution_variable (Extracted_order_execution_variable) as l_order then
if not is_valid_to_update (l_order) then if not is_valid_to_update (l_order) then
req.set_execution_variable ("CONFLICT_CHECK_CODE", {NATURAL} 409) req.set_execution_variable (Conflict_check_code_execution_variable, {NATURAL} 409)
handle_resource_conflict_response (l_order.out +"%N There is conflict while trying to update the order, the order could not be update in the current state", req, res) handle_resource_conflict_response (l_order.out +"%N There is conflict while trying to update the order, the order could not be update in the current state", req, res)
end end
else else
req.set_execution_variable ("CONFLICT_CHECK_CODE", {NATURAL} 409) req.set_execution_variable (Conflict_check_code_execution_variable, {NATURAL} 409)
--| This ought to be a 500, as if attached should probably be check attached. But as yet I lack a proof. --| This ought to be a 500, as if attached should probably be check attached. But as yet I lack a proof.
handle_resource_conflict_response ("There is conflict while trying to update the order, the order could not be update in the current state", req, res) handle_resource_conflict_response ("There is conflict while trying to update the order, the order could not be update in the current state", req, res)
end end
@@ -358,31 +363,31 @@ feature -- PUT/POST
check_request (req: WSF_REQUEST; res: WSF_RESPONSE) check_request (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Check that the request entity is a valid request. -- Check that the request entity is a valid request.
-- The entity is available as `req.execution_variable ("REQUEST_ENTITY")'. -- The entity is available as `req.execution_variable (Conflict_check_code_execution_variable)'.
-- Set `req.execution_variable ("REQUEST_CHECK_CODE")' to {NATURAL} zero if OK, or 400 if not. -- Set `req.execution_variable (Request_check_code_execution_variable)' to {NATURAL} zero if OK, or 400 if not.
-- In the latter case, write the full error response to `res'. -- In the latter case, write the full error response to `res'.
local local
l_order: detachable ORDER l_order: detachable ORDER
l_id: STRING l_id: STRING
do do
if attached {READABLE_STRING_8} req.execution_variable ("REQUEST_ENTITY") as l_request then if attached {READABLE_STRING_8} req.execution_variable (Request_entity_execution_variable) as l_request then
l_order := extract_order_request (l_request) l_order := extract_order_request (l_request)
if req.is_put_request_method then if req.is_put_request_method then
l_id := order_id_from_request (req) l_id := order_id_from_request (req)
if l_order /= Void and then db_access.orders.has_key (l_id) then if l_order /= Void and then db_access.orders.has_key (l_id) then
l_order.set_id (l_id) l_order.set_id (l_id)
req.set_execution_variable ("REQUEST_CHECK_CODE", {NATURAL} 0) req.set_execution_variable (Request_check_code_execution_variable, {NATURAL} 0)
req.set_execution_variable ("EXTRACTED_ORDER", l_order) req.set_execution_variable (Extracted_order_execution_variable, l_order)
else else
req.set_execution_variable ("REQUEST_CHECK_CODE", {NATURAL} 400) req.set_execution_variable (Request_check_code_execution_variable, {NATURAL} 400)
handle_bad_request_response (l_request +"%N is not a valid ORDER, maybe the order does not exist in the system", req, res) handle_bad_request_response (l_request +"%N is not a valid ORDER, maybe the order does not exist in the system", req, res)
end end
else else
req.set_execution_variable ("REQUEST_CHECK_CODE", {NATURAL} 0) req.set_execution_variable (Request_check_code_execution_variable, {NATURAL} 0)
req.set_execution_variable ("EXTRACTED_ORDER", l_order) req.set_execution_variable (Extracted_order_execution_variable, l_order)
end end
else else
req.set_execution_variable ("REQUEST_CHECK_CODE", {NATURAL} 400) req.set_execution_variable (Request_check_code_execution_variable, {NATURAL} 400)
handle_bad_request_response ("Request is not a valid ORDER", req, res) handle_bad_request_response ("Request is not a valid ORDER", req, res)
end end
end end
@@ -391,7 +396,7 @@ feature -- PUT/POST
-- Perform the update requested in `req'. -- Perform the update requested in `req'.
-- Write a response to `res' with a code of 204 or 500. -- Write a response to `res' with a code of 204 or 500.
do do
if attached {ORDER} req.execution_variable ("EXTRACTED_ORDER") as l_order then if attached {ORDER} req.execution_variable (Extracted_order_execution_variable) as l_order then
update_order (l_order) update_order (l_order)
compute_response_put (req, res, l_order) compute_response_put (req, res, l_order)
else else

View File

@@ -12,7 +12,7 @@ deferred class WSF_METHOD_HELPER
inherit inherit
HTTP_STATUS_CODE_MESSAGES HTTP_STATUS_CODE_MESSAGES
SHARED_HTML_ENCODER SHARED_HTML_ENCODER
export {NONE} all end export {NONE} all end
@@ -58,7 +58,7 @@ feature -- Basic operations
l_locs := a_handler.previous_location (req) l_locs := a_handler.previous_location (req)
handle_redirection_error (req, res, l_locs, {HTTP_STATUS_CODE}.found) handle_redirection_error (req, res, l_locs, {HTTP_STATUS_CODE}.found)
else else
check attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") as h then check attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable) as h then
-- postcondition header_attached of `handle_content_negotiation' -- postcondition header_attached of `handle_content_negotiation'
h.put_content_type_text_plain h.put_content_type_text_plain
h.put_current_date h.put_current_date
@@ -68,7 +68,7 @@ feature -- Basic operations
end end
end end
else else
check attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") as h then check attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable) as h then
-- postcondition header_attached of `handle_content_negotiation' -- postcondition header_attached of `handle_content_negotiation'
h.put_content_type_text_plain h.put_content_type_text_plain
h.put_current_date h.put_current_date
@@ -140,7 +140,7 @@ feature -- Basic operations
end end
end end
if not l_failed then if not l_failed then
check attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") as h then check attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable) as h then
-- postcondition header_attached of `handle_content_negotiation' -- postcondition header_attached of `handle_content_negotiation'
send_response (req, res, a_handler, h, False) send_response (req, res, a_handler, h, False)
end end
@@ -154,7 +154,7 @@ feature -- Content negotiation
handle_content_negotiation (req: WSF_REQUEST; res: WSF_RESPONSE; a_handler: WSF_SKELETON_HANDLER) handle_content_negotiation (req: WSF_REQUEST; res: WSF_RESPONSE; a_handler: WSF_SKELETON_HANDLER)
-- Negotiate acceptable content for, then write, response requested by `req' into `res'. -- Negotiate acceptable content for, then write, response requested by `req' into `res'.
-- Policy routines are available in `a_handler'. -- Policy routines are available in `a_handler'.
-- --
-- Either a 406 Not Acceptable error is sent, or upto four execution variables may be set on `req': -- Either a 406 Not Acceptable error is sent, or upto four execution variables may be set on `req':
-- "NEGOTIATED_MEDIA_TYPE" -- "NEGOTIATED_MEDIA_TYPE"
-- "NEGOTIATED_LANGUAGE" -- "NEGOTIATED_LANGUAGE"
@@ -290,7 +290,7 @@ feature {NONE} -- Implementation
l_chunk := a_handler.next_chunk (req) l_chunk := a_handler.next_chunk (req)
res.put_chunk (l_chunk.a_chunk, l_chunk.a_extension) res.put_chunk (l_chunk.a_chunk, l_chunk.a_extension)
else else
write_error_response (req, res) write_error_response (req, res)
end end
end end
if a_handler.finished (req) then if a_handler.finished (req) then
@@ -366,7 +366,7 @@ feature {NONE} -- Implementation
feature -- Errors feature -- Errors
feature -- Error reporting feature -- Error reporting
write_error_response (req: WSF_REQUEST; res: WSF_RESPONSE) write_error_response (req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -439,7 +439,7 @@ feature -- Error reporting
s.append ("<div id=%"footer%"></div>") s.append ("<div id=%"footer%"></div>")
s.append ("</body>%N") s.append ("</body>%N")
s.append ("</html>%N") s.append ("</html>%N")
h.put_content_type_text_html h.put_content_type_text_html
else else
s := "Error " + a_status_code.out + " (" + l_msg + "): " s := "Error " + a_status_code.out + " (" + l_msg + "): "
@@ -566,7 +566,7 @@ feature -- Error reporting
res.set_status_code ({HTTP_STATUS_CODE}.not_implemented) res.set_status_code ({HTTP_STATUS_CODE}.not_implemented)
res.put_header_lines (h) res.put_header_lines (h)
end end
handle_request_entity_too_large (req: WSF_REQUEST; res: WSF_RESPONSE; a_handler: WSF_SKELETON_HANDLER) handle_request_entity_too_large (req: WSF_REQUEST; res: WSF_RESPONSE; a_handler: WSF_SKELETON_HANDLER)
-- Write a Request Entity Too Large response for `req' to `res'. -- Write a Request Entity Too Large response for `req' to `res'.
require require

View File

@@ -22,7 +22,7 @@ feature -- Basic operations
-- Policy routines are available in `a_handler'. -- Policy routines are available in `a_handler'.
do do
if a_handler.allow_post_to_missing_resource (req) then if a_handler.allow_post_to_missing_resource (req) then
check attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") as h then check attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable) as h then
-- postcondition header_attached of `handle_content_negotiation' -- postcondition header_attached of `handle_content_negotiation'
send_response (req, res, a_handler, h, True) send_response (req, res, a_handler, h, True)
end end

View File

@@ -43,10 +43,11 @@ feature -- Access
req_attached: req /= Void req_attached: req /= Void
previously_existed: resource_previously_existed (req) previously_existed: resource_previously_existed (req)
moved: resource_moved_permanently (req) or resource_moved_temporarily (req) moved: resource_moved_permanently (req) or resource_moved_temporarily (req)
deferred do
create {LINKED_LIST [URI]} Result.make
ensure ensure
previous_location_attached: Result /= Void previous_location_attached: Result /= Void
non_empty_list: not Result.empty non_empty_list: not Result.is_empty
end end
note note

View File

@@ -24,7 +24,7 @@ feature -- Basic operations
if a_handler.treat_as_moved_permanently (req) then if a_handler.treat_as_moved_permanently (req) then
handle_redirection_error (req, res, a_handler.previous_location (req), {HTTP_STATUS_CODE}.moved_permanently) handle_redirection_error (req, res, a_handler.previous_location (req), {HTTP_STATUS_CODE}.moved_permanently)
else else
check attached {HTTP_HEADER} req.execution_variable ("NEGOTIATED_HTTP_HEADER") as h then check attached {HTTP_HEADER} req.execution_variable (a_handler.Negotiated_http_header_execution_variable) as h then
-- postcondition header_attached of `handle_content_negotiation' -- postcondition header_attached of `handle_content_negotiation'
send_response (req, res, a_handler, h, True) send_response (req, res, a_handler, h, True)
end end
@@ -68,5 +68,15 @@ feature {NONE} -- Implementation
end end
end end
end end
note
copyright: "2011-2013, 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 end

View File

@@ -30,7 +30,7 @@ feature -- Execution variables
Negotiated_language_execution_variable: STRING = "NEGOTIATED_LANGUAGE" Negotiated_language_execution_variable: STRING = "NEGOTIATED_LANGUAGE"
-- Execution variable set by framework -- Execution variable set by framework
Negotiated_charset_execution_variable: STRING = "NEGOTIATED_CHARSET" Negotiated_charset_execution_variable: STRING = "NEGOTIATED_CHARSET"
-- Execution variable set by framework -- Execution variable set by framework
@@ -46,6 +46,15 @@ feature -- Execution variables
Request_entity_execution_variable: STRING = "REQUEST_ENTITY" Request_entity_execution_variable: STRING = "REQUEST_ENTITY"
-- Execution variable set by framework -- Execution variable set by framework
Conflict_check_code_execution_variable: STRING = "CONFLICT_CHECK_CODE"
-- Execution variable set by framework
Content_check_code_execution_variable: STRING = "CONTENT_CHECK_CODE"
-- Execution variable set by framework
Request_check_code_execution_variable: STRING = "REQUEST_CHECK_CODE"
-- Execution variable set by framework
feature -- Access feature -- Access
is_chunking (req: WSF_REQUEST): BOOLEAN is_chunking (req: WSF_REQUEST): BOOLEAN
@@ -329,7 +338,7 @@ feature -- PUT/POST
end end
is_entity_too_large (req: WSF_REQUEST): BOOLEAN is_entity_too_large (req: WSF_REQUEST): BOOLEAN
-- Is the entity stored in `req.execution_variable ("REQUEST_ENTITY")' too large for the application? -- Is the entity stored in `req.execution_variable (Request_entity_execution_variable)' too large for the application?
require require
req_attached: req /= Void req_attached: req /= Void
deferred deferred
@@ -337,7 +346,7 @@ feature -- PUT/POST
check_content_headers (req: WSF_REQUEST) check_content_headers (req: WSF_REQUEST)
-- Check we can support all content headers on request entity. -- Check we can support all content headers on request entity.
-- Set `req.execution_variable ("CONTENT_CHECK_CODE")' to {NATURAL} zero if OK, or 415 or 501 if not. -- Set `req.execution_variable (Content_check_code_execution_variable)' to {NATURAL} zero if OK, or 415 or 501 if not.
require require
req_attached: req /= Void req_attached: req /= Void
deferred deferred
@@ -348,7 +357,7 @@ feature -- PUT/POST
require require
req_attached: req /= Void req_attached: req /= Void
do do
if attached {NATURAL} req.execution_variable ("CONTENT_CHECK_CODE") as l_code then if attached {NATURAL} req.execution_variable (Content_check_code_execution_variable) as l_code then
Result := l_code Result := l_code
end end
end end
@@ -375,7 +384,7 @@ feature -- PUT/POST
check_conflict (req: WSF_REQUEST; res: WSF_RESPONSE) check_conflict (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Check to see if updating the resource is problematic due to the current state of the resource. -- Check to see if updating the resource is problematic due to the current state of the resource.
-- Set `req.execution_variable ("CONFLICT_CHECK_CODE")' to {NATURAL} zero if OK, or 409 if not. -- Set `req.execution_variable (Conflict_check_code_execution_variable)' to {NATURAL} zero if OK, or 409 if not.
-- In the latter case, write the full error response to `res'. -- In the latter case, write the full error response to `res'.
require require
req_attached: req /= Void req_attached: req /= Void
@@ -388,15 +397,15 @@ feature -- PUT/POST
require require
req_attached: req /= Void req_attached: req /= Void
do do
if attached {NATURAL} req.execution_variable ("CONFLICT_CHECK_CODE") as l_code then if attached {NATURAL} req.execution_variable (Conflict_check_code_execution_variable) as l_code then
Result := l_code Result := l_code
end end
end end
check_request (req: WSF_REQUEST; res: WSF_RESPONSE) check_request (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Check that the request entity is a valid request. -- Check that the request entity is a valid request.
-- The entity is available as `req.execution_variable ("REQUEST_ENTITY")'. -- The entity is available as `req.execution_variable (Conflict_check_code_execution_variable)'.
-- Set `req.execution_variable ("REQUEST_CHECK_CODE")' to {NATURAL} zero if OK, or 400 if not. -- Set `req.execution_variable (Request_check_code_execution_variable)' to {NATURAL} zero if OK, or 400 if not.
-- In the latter case, write the full error response to `res'. -- In the latter case, write the full error response to `res'.
require require
req_attached: req /= Void req_attached: req /= Void
@@ -410,7 +419,7 @@ feature -- PUT/POST
require require
req_attached: req /= Void req_attached: req /= Void
do do
if attached {NATURAL} req.execution_variable ("REQUEST_CHECK_CODE") as l_code then if attached {NATURAL} req.execution_variable (Request_check_code_execution_variable) as l_code then
Result := l_code Result := l_code
end end
end end