Implemented 414 and 503 responses on WSF_ROUTED_SERVICE
This commit is contained in:
@@ -4,22 +4,10 @@ note
|
|||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class ORDER_HANDLER
|
||||||
ORDER_HANDLER
|
|
||||||
inherit
|
inherit
|
||||||
WSF_URI_HANDLER
|
|
||||||
rename
|
|
||||||
execute as uri_execute,
|
|
||||||
new_mapping as new_uri_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_HANDLER
|
WSF_URI_TEMPLATE_HANDLER
|
||||||
rename
|
|
||||||
execute as uri_template_execute,
|
|
||||||
new_mapping as new_uri_template_mapping
|
|
||||||
select
|
|
||||||
new_uri_template_mapping
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_RESOURCE_HANDLER_HELPER
|
WSF_RESOURCE_HANDLER_HELPER
|
||||||
redefine
|
redefine
|
||||||
@@ -28,22 +16,20 @@ inherit
|
|||||||
do_put,
|
do_put,
|
||||||
do_delete
|
do_delete
|
||||||
end
|
end
|
||||||
|
|
||||||
SHARED_DATABASE_API
|
SHARED_DATABASE_API
|
||||||
|
|
||||||
SHARED_EJSON
|
SHARED_EJSON
|
||||||
|
|
||||||
REFACTORING_HELPER
|
REFACTORING_HELPER
|
||||||
|
|
||||||
SHARED_ORDER_VALIDATION
|
SHARED_ORDER_VALIDATION
|
||||||
|
|
||||||
WSF_SELF_DOCUMENTED_HANDLER
|
WSF_SELF_DOCUMENTED_HANDLER
|
||||||
|
|
||||||
feature -- execute
|
feature -- Execute
|
||||||
|
|
||||||
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
-- Execute request handler
|
|
||||||
do
|
|
||||||
execute_methods (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- Execute request handler
|
-- Execute request handler
|
||||||
do
|
do
|
||||||
execute_methods (req, res)
|
execute_methods (req, res)
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ inherit
|
|||||||
ANY
|
ANY
|
||||||
|
|
||||||
WSF_URI_TEMPLATE_ROUTED_SERVICE
|
WSF_URI_TEMPLATE_ROUTED_SERVICE
|
||||||
redefine
|
|
||||||
execute_default
|
|
||||||
end
|
|
||||||
|
|
||||||
WSF_HANDLER_HELPER
|
WSF_HANDLER_HELPER
|
||||||
|
|
||||||
@@ -42,18 +39,9 @@ feature {NONE} -- Initialization
|
|||||||
router.handle_with_request_methods ("/api/doc", doc, router.methods_GET)
|
router.handle_with_request_methods ("/api/doc", doc, router.methods_GET)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Execution
|
|
||||||
|
|
||||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
||||||
-- I'm using this method to handle the method not allowed response
|
|
||||||
-- in the case that the given uri does not have a corresponding http method
|
|
||||||
-- to handle it.
|
|
||||||
do
|
|
||||||
Precursor (req, res)
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Javier Velilla and others"
|
copyright: "2011-2013, Javier Velilla and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ feature -- Execution
|
|||||||
req_attached: req /= Void
|
req_attached: req /= Void
|
||||||
res_attached: res /= Void
|
res_attached: res /= Void
|
||||||
do
|
do
|
||||||
|
--| When we reach here, the request has already passed check for 400 (Bad request),
|
||||||
|
--| which is implemented in WSF_REQUEST.make_from_wgi (when it calls `analyze').
|
||||||
if unavailable then
|
if unavailable then
|
||||||
handle_unavailable (res)
|
handle_unavailable (res)
|
||||||
elseif maximum_uri_length > 0 and then req.request_uri.count.to_natural_32 > maximum_uri_length then
|
elseif maximum_uri_length > 0 and then req.request_uri.count.to_natural_32 > maximum_uri_length then
|
||||||
@@ -60,6 +62,7 @@ feature -- Execution
|
|||||||
local
|
local
|
||||||
msg: WSF_DEFAULT_ROUTER_RESPONSE
|
msg: WSF_DEFAULT_ROUTER_RESPONSE
|
||||||
do
|
do
|
||||||
|
--| TODO: update this to distinguish between 501, 403 and 404 results.
|
||||||
create msg.make_with_router (req, router)
|
create msg.make_with_router (req, router)
|
||||||
msg.set_documentation_included (True)
|
msg.set_documentation_included (True)
|
||||||
res.send (msg)
|
res.send (msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user