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
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
port=8088
|
||||
port=8099
|
||||
#verbose=true
|
||||
@@ -12,10 +12,10 @@
|
||||
{if isset="$user"}
|
||||
<li><a>{$user/}</a></li>
|
||||
<li><a title="Node" href="{$host/}/node" rel="node">New Node</a></li>
|
||||
<li><a title="Logoff" href="{$host/}/basic_auth/logoff" rel="logoff">Logoff</a></li>
|
||||
<li><a title="Logoff" href="{$host/}/basic_auth_logoff" rel="logoff">Logoff</a></li>
|
||||
{/if}
|
||||
{unless isset="$user"}
|
||||
<li><a title="Login" href="{$host/}/basic_auth/login" rel="login">Login</a></li>
|
||||
<li><a title="Login" href="{$host/}/basic_auth_login" rel="login">Login</a></li>
|
||||
<li><a title="Register" href="{$host/}/user" rel="register">Register</a></li>
|
||||
{/unless}
|
||||
</ul>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-1">
|
||||
{if isset="$node"}
|
||||
<label> <span itemprop="description"><a href="{$host/}/node/{$node.id/}/content" rel="node">Summary:</a></span></label>
|
||||
<label> <span itemprop="description"><a href="{$host/}/node/{$node.id/}/summary" rel="node">Summary:</a></span></label>
|
||||
{/if}
|
||||
{unless isset="$node"}
|
||||
<label> <span itemprop="description">Summary:</span></label>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<label> <span itemprop="text">Content:</span> </label>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<textarea id="content" rows="25" cols="100" class="form-control" name="content" placeholder="Node content" required>{$content/}</textarea>
|
||||
<textarea id="content" rows="25" cols="100" class="form-control" name="content" placeholder="Node content" required>{$node_content/}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<label> <span itemprop="text">Summary:</span> </label>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<textarea id="summary" rows="3" cols="80" name="summary" placeholder="Node summary" required>{$summary/}</textarea>
|
||||
<textarea id="summary" rows="3" cols="80" name="summary" placeholder="Node summary" required>{$node_summary/}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<label> <span itemprop="text">Title:</span> </label>
|
||||
</div>
|
||||
<div class="col-xs-7">
|
||||
<input id="title" type="text" name="title" placeholder="Title" required value="{$title/}"/>
|
||||
<input id="title" type="text" name="title" placeholder="Title" required value="{$node_title/}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ inherit
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
WSF_SERVICE
|
||||
redefine
|
||||
execute
|
||||
|
||||
Reference in New Issue
Block a user