Reviewed WSF_REQUEST.item (..) and items to look into Form, Query, and Path (cookie are excluded for security)
Added WSF_REQUEST.path_parameter (a_name): detachable WSF_VALUE
- fill path_parameters using `import_raw_path_parameters"
when executing the route
- reset to previous value with reset_path_parameters (..),
just in case the request is executed via severals routes.
This commit is contained in:
@@ -26,6 +26,18 @@ feature {NONE} -- Initialization
|
||||
path := p
|
||||
end
|
||||
|
||||
feature -- Request data
|
||||
|
||||
apply (req: WSF_REQUEST)
|
||||
-- <Precursor>
|
||||
do
|
||||
end
|
||||
|
||||
revert (req: WSF_REQUEST)
|
||||
-- <Precursor>
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Item
|
||||
|
||||
item (a_name: READABLE_STRING_32): detachable WSF_VALUE
|
||||
|
||||
@@ -43,6 +43,24 @@ feature -- Access
|
||||
|
||||
uri_template_match: URI_TEMPLATE_MATCH_RESULT
|
||||
|
||||
feature -- Environment
|
||||
|
||||
old_path_parameters: detachable ITERABLE [WSF_VALUE]
|
||||
|
||||
apply (req: WSF_REQUEST)
|
||||
-- <Precursor>
|
||||
do
|
||||
old_path_parameters := req.path_parameters
|
||||
req.import_raw_path_parameters (uri_template_match.path_variables)
|
||||
end
|
||||
|
||||
revert (req: WSF_REQUEST)
|
||||
-- <Precursor>
|
||||
do
|
||||
if attached old_path_parameters as vals then
|
||||
req.reset_path_parameters (vals)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Item
|
||||
|
||||
|
||||
@@ -27,6 +27,20 @@ feature -- Access
|
||||
path: READABLE_STRING_8
|
||||
-- Associated path
|
||||
|
||||
feature -- Request data
|
||||
|
||||
apply (req: WSF_REQUEST)
|
||||
-- Apply current data to request `req'
|
||||
--| mainly to fill {WSF_REQUEST}.path_parameters
|
||||
deferred
|
||||
end
|
||||
|
||||
revert (req: WSF_REQUEST)
|
||||
-- Revert potential previous `apply' for request `req'
|
||||
--| mainly to restore previous {WSF_REQUEST}.path_parameters
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Url Query
|
||||
|
||||
script_absolute_url (a_path: STRING): STRING
|
||||
|
||||
@@ -144,9 +144,16 @@ feature -- Execution
|
||||
-- Process route `a_route'
|
||||
require
|
||||
a_route_attached: a_route /= Void
|
||||
local
|
||||
ctx: C
|
||||
do
|
||||
pre_route_execution_actions.call ([a_route])
|
||||
a_route.handler.execute (a_route.context, req, res)
|
||||
ctx := a_route.context
|
||||
ctx.apply (req)
|
||||
a_route.handler.execute (ctx, req, res)
|
||||
ctx.revert (req)
|
||||
rescue
|
||||
a_route.context.revert (req)
|
||||
end
|
||||
|
||||
dispatch (req: WSF_REQUEST; res: WSF_RESPONSE): BOOLEAN
|
||||
|
||||
Reference in New Issue
Block a user