Updated CMS libary:
Initial Basic Authentication Node with filters. Updated ROC API to use the new module.
This commit is contained in:
@@ -62,7 +62,7 @@ feature -- Configure Node Resources Routes
|
||||
create l_bal_handler.make (config)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
router.handle_with_request_methods ("/basic_auth/login", l_bal_handler, l_methods)
|
||||
router.handle_with_request_methods ("/basic_auth_login", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_logoff
|
||||
@@ -73,7 +73,7 @@ feature -- Configure Node Resources Routes
|
||||
create l_bal_handler.make (config)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
router.handle_with_request_methods ("/basic_auth/logoff", l_bal_handler, l_methods)
|
||||
router.handle_with_request_methods ("/basic_auth_logoff", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ feature -- HTTP Methods
|
||||
do
|
||||
log.write_information(generator + ".do_get Processing basic auth login")
|
||||
if attached {STRING_32} current_user_name (req) as l_user then
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url(""))
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url("/"))
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_authenticate (req, res)
|
||||
end
|
||||
|
||||
@@ -71,7 +71,7 @@ feature -- HTTP Methods
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_content")
|
||||
l_page.add_variable (l_node.content, "content")
|
||||
l_page.add_variable (l_node.content, "node_content")
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.execute
|
||||
else
|
||||
|
||||
@@ -70,8 +70,8 @@ feature -- HTTP Methods
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_summary")
|
||||
l_page.add_variable (l_node.summary, "summary")
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.add_variable (l_node.summary, "node_summary")
|
||||
l_page.execute
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
|
||||
@@ -70,20 +70,14 @@ feature -- HTTP Methods
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if l_id.is_integer and then attached {CMS_NODE} api_service.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_title")
|
||||
l_page.add_variable (setup.is_html, "html")
|
||||
l_page.add_variable (setup.is_web, "web")
|
||||
l_page.add_variable (l_node.title, "title")
|
||||
l_page.add_variable (l_node.title, "node_title")
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.execute
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
to_implement ("Check how to implement API error")
|
||||
-- create l_page.make (req, "master2/error")
|
||||
-- l_page.set_value ("500", "code")
|
||||
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
|
||||
-- l_page.send_to (res)
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
|
||||
@@ -19,6 +19,7 @@ inherit
|
||||
execute_default
|
||||
end
|
||||
|
||||
|
||||
WSF_FILTERED_SERVICE
|
||||
|
||||
WSF_FILTER
|
||||
@@ -120,23 +121,6 @@ feature {NONE} -- Initialization
|
||||
router.handle_with_request_methods ("/", fhdl, router.methods_GET)
|
||||
end
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
setup: CMS_SETUP
|
||||
-- CMS setup.
|
||||
|
||||
configuration: CMS_CONFIGURATION
|
||||
-- CMS configuration.
|
||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
||||
|
||||
modules: LIST [CMS_MODULE]
|
||||
-- List of possible modules.
|
||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
||||
|
||||
filters: LIST[WSF_FILTER]
|
||||
-- List of possible filters.
|
||||
|
||||
feature -- Execute Filter
|
||||
|
||||
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
@@ -186,6 +170,23 @@ feature -- Filters
|
||||
f.set_next (Current)
|
||||
end
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
setup: CMS_SETUP
|
||||
-- CMS setup.
|
||||
|
||||
configuration: CMS_CONFIGURATION
|
||||
-- CMS configuration.
|
||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
||||
|
||||
modules: LIST [CMS_MODULE]
|
||||
-- List of possible modules.
|
||||
-- | Maybe we can compute it (using `setup') instead of using memory.
|
||||
|
||||
filters: LIST[WSF_FILTER]
|
||||
-- List of possible filters.
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
|
||||
@@ -9,6 +9,8 @@ deferred class
|
||||
|
||||
inherit
|
||||
|
||||
WSF_HANDLER
|
||||
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
@@ -178,6 +178,8 @@ feature {NONE} -- Execution
|
||||
prepare (cms_page)
|
||||
create page.make (theme.page_html (cms_page))
|
||||
page.set_status_code (status_code)
|
||||
page.header.put_content_length (page.html.count)
|
||||
page.header.put_current_date
|
||||
response.send (page)
|
||||
on_terminated
|
||||
end
|
||||
|
||||
@@ -30,8 +30,8 @@ feature -- Execution
|
||||
process
|
||||
-- Computed response message.
|
||||
do
|
||||
set_title ("CMS")
|
||||
set_page_title (Void)
|
||||
-- set_title ("CMS")
|
||||
-- set_page_title (Void)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ feature -- Access
|
||||
end
|
||||
|
||||
if attached page.title as l_title then
|
||||
variables.force (l_title, "title")
|
||||
variables.force (l_title, "page_title")
|
||||
variables.force (l_title, "head_title")
|
||||
else
|
||||
variables.force ("", "title")
|
||||
variables.force ("", "page_title")
|
||||
variables.force ("", "head_title")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user