Compare commits
4 Commits
concurrent
...
jfiat
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a8683a139 | |||
| f3c3407b0a | |||
| 20471923fd | |||
| b235fb30a7 |
14
cms-safe.ecf
14
cms-safe.ecf
@@ -8,19 +8,19 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="config" location=".\library\configuration\config-safe.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="http_authorization" location="$EWF_LIBRARY\library\server\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location=".\library\layout\layout-safe.ecf"/>
|
||||
<library name="cms_model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
|
||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
|
||||
14
cms.ecf
14
cms.ecf
@@ -8,19 +8,19 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="config" location=".\library\configuration\config.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
|
||||
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http.ecf"/>
|
||||
<library name="http_authorization" location="$EWF_LIBRARY\library\network\authentication\http_authorization\http_authorization.ecf" readonly="false"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization.ecf" readonly="false"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="layout" location=".\library\layout\layout.ecf"/>
|
||||
<library name="cms_model" location=".\library\model\cms_model.ecf" readonly="false"/>
|
||||
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty.ecf" readonly="false"/>
|
||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf.ecf"/>
|
||||
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
|
||||
@@ -9,50 +9,43 @@
|
||||
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\library\layout\layout-safe.ecf" readonly="false"/>
|
||||
<!--
|
||||
<library name="persistence_mysql" location="..\..\library\persistence\mysql\persistence_mysql-safe.ecf" readonly="false"/>
|
||||
-->
|
||||
<library name="persistence_sqlite" location="..\..\library\persistence\sqlite\persistence_sqlite-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
|
||||
</target>
|
||||
<target name="demo_any" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<library name="cgi" location="$EWF_LIBRARY\library\server\wsf\connector\cgi-safe.ecf"/>
|
||||
<library name="libfcgi" location="$EWF_LIBRARY\library\server\wsf\connector\libfcgi-safe.ecf"/>
|
||||
<library name="nino" location="$EWF_LIBRARY\library\server\wsf\connector\nino-safe.ecf"/>
|
||||
<library name="standalone" location="$EWF_LIBRARY\library\server\wsf\connector\standalone-safe.ecf"/>
|
||||
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
|
||||
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
|
||||
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_standalone" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<library name="default_standalone" location="$EWF_LIBRARY\library\server\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_nino" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="default_nino" location="$EWF_LIBRARY\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_cgi" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<library name="default_cgi" location="$EWF_LIBRARY\library\server\wsf\default\cgi-safe.ecf"/>
|
||||
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_libfcgi" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<library name="default_libfcgi" location="$EWF_LIBRARY\library\server\wsf\default\libfcgi-safe.ecf"/>
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
port=9090
|
||||
#verbose=true
|
||||
port=8099
|
||||
#verbose=true
|
||||
@@ -8,10 +8,10 @@ note
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
class
|
||||
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
APPLICATION_LAUNCHER
|
||||
|
||||
inherit
|
||||
APPLICATION_LAUNCHER_I [G]
|
||||
APPLICATION_LAUNCHER_I
|
||||
|
||||
feature -- Custom
|
||||
|
||||
|
||||
@@ -10,28 +10,24 @@ note
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
deferred class
|
||||
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||
APPLICATION_LAUNCHER_I
|
||||
|
||||
inherit
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
nature: like launcher_nature
|
||||
do
|
||||
nature := launcher_nature
|
||||
if nature = Void then
|
||||
launch_standalone (opts)
|
||||
elseif nature = nature_standalone then
|
||||
launch_standalone (opts)
|
||||
elseif nature = nature_nino then
|
||||
launch_nino (opts)
|
||||
if nature = Void or else nature = nature_nino then
|
||||
launch_nino (a_service, opts)
|
||||
elseif nature = nature_cgi then
|
||||
launch_cgi (opts)
|
||||
launch_cgi (a_service, opts)
|
||||
elseif nature = nature_libfcgi then
|
||||
launch_libfcgi (opts)
|
||||
launch_libfcgi (a_service, opts)
|
||||
else
|
||||
-- bye bye
|
||||
(create {EXCEPTIONS}).die (-1)
|
||||
@@ -47,16 +43,14 @@ feature {NONE} -- Access
|
||||
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
|
||||
local
|
||||
p: PATH
|
||||
l_entry_name: READABLE_STRING_32
|
||||
ext: detachable READABLE_STRING_32
|
||||
do
|
||||
create p.make_from_string (execution_environment.arguments.command_name)
|
||||
if attached p.entry as l_entry then
|
||||
ext := l_entry.extension
|
||||
ext := l_entry.extension
|
||||
end
|
||||
if ext /= Void then
|
||||
if ext.same_string (nature_standalone) then
|
||||
Result := nature_standalone
|
||||
end
|
||||
if ext.same_string (nature_nino) then
|
||||
Result := nature_nino
|
||||
end
|
||||
@@ -67,58 +61,39 @@ feature {NONE} -- Access
|
||||
Result := nature_libfcgi
|
||||
end
|
||||
end
|
||||
Result := default_nature
|
||||
end
|
||||
|
||||
feature {NONE} -- standalone
|
||||
|
||||
nature_standalone: STRING = "standalone"
|
||||
|
||||
launch_standalone (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_STANDALONE_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- nino
|
||||
|
||||
nature_nino: STRING = "nino"
|
||||
|
||||
launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
|
||||
launcher: WSF_NINO_SERVICE_LAUNCHER
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
create launcher.make_and_launch (a_service, opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- cgi
|
||||
|
||||
nature_cgi: STRING = "cgi"
|
||||
|
||||
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
|
||||
launcher: WSF_CGI_SERVICE_LAUNCHER
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
create launcher.make_and_launch (a_service, opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- libfcgi
|
||||
|
||||
nature_libfcgi: STRING = "libfcgi"
|
||||
|
||||
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
|
||||
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature -- Default
|
||||
|
||||
default_nature: STRING
|
||||
do
|
||||
Result := nature_standalone
|
||||
create launcher.make_and_launch (a_service, opts)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ note
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
class
|
||||
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
APPLICATION_LAUNCHER
|
||||
|
||||
inherit
|
||||
APPLICATION_LAUNCHER_I [G]
|
||||
APPLICATION_LAUNCHER_I
|
||||
|
||||
feature -- Custom
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ note
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
deferred class
|
||||
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||
APPLICATION_LAUNCHER_I
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_DEFAULT_SERVICE_LAUNCHER [G]
|
||||
launcher: WSF_DEFAULT_SERVICE_LAUNCHER
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms_model" location="..\..\..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="$EWF_LIBRARY\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"database": {
|
||||
"datasource": {
|
||||
"driver": "MySQL",
|
||||
"environment": "development"
|
||||
"driver": "sqlite",
|
||||
"environment": "sqlite"
|
||||
},
|
||||
"environments": {
|
||||
"sqlite": {
|
||||
"connection_string":"Driver=SQLite3 ODBC Driver;Database=./site/database.sqlite;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
|
||||
},
|
||||
"test": {
|
||||
"connection_string":"Server=localhost;Port=3306;Database=cms_dev;Uid=root;Pwd=;"
|
||||
},
|
||||
@@ -29,4 +32,4 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,17 @@ inherit
|
||||
initialize
|
||||
end
|
||||
|
||||
WSF_SERVICE
|
||||
redefine
|
||||
execute
|
||||
end
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
@@ -36,19 +43,36 @@ feature {NONE} -- Initialization
|
||||
do
|
||||
Precursor
|
||||
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
|
||||
initialize_cms (cms_setup)
|
||||
end
|
||||
|
||||
feature -- Service
|
||||
|
||||
cms_service: CMS_SERVICE
|
||||
-- cms service.
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
cms_service.execute (req, res)
|
||||
end
|
||||
|
||||
feature -- Layout
|
||||
|
||||
layout: CMS_LAYOUT
|
||||
-- cms layout.
|
||||
|
||||
feature {NONE} -- Launch operation
|
||||
|
||||
launcher: APPLICATION_LAUNCHER [EWF_ROC_SERVER_EXECUTION]
|
||||
launcher: APPLICATION_LAUNCHER
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
l_retry: BOOLEAN
|
||||
l_message: STRING
|
||||
do
|
||||
if not l_retry then
|
||||
launcher.launch (opts)
|
||||
write_debug_log (generator + ".launch")
|
||||
launcher.launch (a_service, opts)
|
||||
else
|
||||
-- error hanling.
|
||||
create l_message.make (1024)
|
||||
@@ -68,11 +92,68 @@ feature {NONE} -- Launch operation
|
||||
l_message.append ("%N%N")
|
||||
end
|
||||
-- send email shutdown
|
||||
write_debug_log (generator + ".launch shutdown")
|
||||
end
|
||||
rescue
|
||||
l_retry := True
|
||||
retry
|
||||
end
|
||||
|
||||
feature -- CMS Initialization
|
||||
|
||||
cms_setup: CMS_DEFAULT_SETUP
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
|
||||
create layout.make_with_directory_name (l_dir)
|
||||
else
|
||||
create layout.make_default
|
||||
end
|
||||
initialize_logger (layout)
|
||||
write_debug_log (generator + ".cms_setup based directory %"" + utf.escaped_utf_32_string_to_utf_8_string_8 (layout.path.name) + "%"")
|
||||
create Result.make (layout)
|
||||
setup_storage (Result)
|
||||
end
|
||||
|
||||
initialize_cms (a_setup: CMS_SETUP)
|
||||
local
|
||||
cms: CMS_SERVICE
|
||||
api: CMS_API
|
||||
do
|
||||
write_debug_log (generator + ".initialize_cms")
|
||||
setup_modules (a_setup)
|
||||
create api.make (a_setup)
|
||||
create cms.make (api)
|
||||
cms_service := cms
|
||||
end
|
||||
|
||||
feature -- CMS setup
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
-- Setup additional modules.
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create {BASIC_AUTH_MODULE} m.make
|
||||
if not a_setup.module_with_same_type_registered (m) then
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
create {CMS_DEMO_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
do
|
||||
debug ("refactor_fixme")
|
||||
to_implement ("To implement custom storage")
|
||||
end
|
||||
-- a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE_BUILDER}.make, "sqlite")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {EWF_ROC_SERVER_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWF_ROC_SERVER_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
end
|
||||
|
||||
feature -- CMS setup
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
-- Setup additional modules.
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create {BASIC_AUTH_MODULE} m.make
|
||||
if not a_setup.module_with_same_type_registered (m) then
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
create {CMS_DEMO_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
do
|
||||
debug ("refactor_fixme")
|
||||
to_implement ("To implement custom storage")
|
||||
end
|
||||
-- a_setup.storage_drivers.force (create {CMS_STORAGE_MYSQL_BUILDER}.make, "mysql")
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE_BUILDER}.make, "sqlite")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -14,10 +14,17 @@ inherit
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
make,
|
||||
make_empty
|
||||
|
||||
feature{NONE} -- Initialization
|
||||
|
||||
make_empty
|
||||
-- Create empty node.
|
||||
do
|
||||
make ({STRING_32} "", {STRING_32} "", {STRING_32} "")
|
||||
end
|
||||
|
||||
make (a_content: READABLE_STRING_32; a_summary: READABLE_STRING_32; a_title: READABLE_STRING_32)
|
||||
-- Create current node with `a_content', `a_summary' and `a_title'.
|
||||
local
|
||||
@@ -83,9 +90,6 @@ feature -- Access
|
||||
author: detachable CMS_USER
|
||||
-- Author of current node.
|
||||
|
||||
-- collaborators: detachable LIST[CMS_USER]
|
||||
-- -- Users contributed to current Node.
|
||||
|
||||
feature -- status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
@@ -191,6 +195,6 @@ feature -- Element change
|
||||
-- end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms.ecf" readonly="false"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\layout\layout.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms-safe.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\layout\layout-safe.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\..\..\cms.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
|
||||
<library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="layout" location="..\..\layout\layout.ecf"/>
|
||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
note
|
||||
description: "This module allows the use of HTTP Basic Authentication to restrict access by looking up users in the given providers."
|
||||
description: "[
|
||||
This module allows the use of HTTP Basic Authentication to restrict access
|
||||
by looking up users in the given providers.
|
||||
]"
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
@@ -82,7 +85,7 @@ feature -- Hooks configuration
|
||||
-- Module hooks configuration.
|
||||
do
|
||||
-- a_response.subscribe_to_block_hook (Current)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
@@ -107,9 +110,9 @@ feature -- Hooks
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
if attached a_response.current_user (a_response.request) as u then
|
||||
create lnk.make ("Logout", "/basic_auth_logoff")
|
||||
create lnk.make (u.name + " (Logout)", "/basic_auth_logoff?destination=" + a_response.request.request_uri)
|
||||
else
|
||||
create lnk.make ("Login", "/basic_auth_login")
|
||||
create lnk.make ("Login", "/basic_auth_login?destination=" + a_response.request.request_uri)
|
||||
end
|
||||
-- if not a_menu_system.primary_menu.has (lnk) then
|
||||
lnk.set_weight (99)
|
||||
|
||||
@@ -50,11 +50,21 @@ feature -- HTTP Methods
|
||||
do
|
||||
api.logger.put_information (generator + ".do_get Processing basic auth login", Void)
|
||||
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("/"))
|
||||
if attached {WSF_STRING} req.query_parameter ("destination") as l_uri then
|
||||
redirect_to (req.absolute_script_url (l_uri.url_encoded_value), res)
|
||||
else
|
||||
redirect_to (req.absolute_script_url ("/"), res)
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_authenticate (req, res)
|
||||
send_basic_authentication_challenge (Void, res)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
send_basic_authentication_challenge (a_realm: detachable READABLE_STRING_8; res: WSF_RESPONSE)
|
||||
do
|
||||
res.send (create {CMS_UNAUTHORIZED_RESPONSE_MESSAGE}.make_with_basic_auth_challenge (a_realm))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -45,13 +45,29 @@ feature -- HTTP Methods
|
||||
-- <Precursor>
|
||||
local
|
||||
l_page: CMS_RESPONSE
|
||||
l_url: STRING
|
||||
i: INTEGER
|
||||
do
|
||||
api.logger.put_information (generator + ".do_get Processing basic auth logoff", Void)
|
||||
if attached req.query_parameter ("prompt") as l_prompt then
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
unset_current_user (req)
|
||||
send_access_denied (res)
|
||||
else
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||
unset_current_user (req)
|
||||
l_page.set_status_code ({HTTP_STATUS_CODE}.found) -- Note: can not use {HTTP_STATUS_CODE}.unauthorized for redirection
|
||||
if attached {WSF_STRING} req.query_parameter ("destination") as l_uri then
|
||||
l_url := req.absolute_script_url (l_uri.url_encoded_value)
|
||||
else
|
||||
l_url := req.absolute_script_url ("")
|
||||
end
|
||||
i := l_url.substring_index ("://", 1)
|
||||
if i > 0 then
|
||||
-- Note: this is a hack to have the logout effective on various browser
|
||||
-- (firefox requires this).
|
||||
l_url.replace_substring ("://_logout_basic_auth_@", i, i + 2)
|
||||
end
|
||||
l_page.set_redirection (l_url)
|
||||
l_page.execute
|
||||
end
|
||||
end
|
||||
|
||||
@@ -77,7 +77,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,7 +102,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -118,7 +118,7 @@ feature -- HTTP Methods
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.value.to_integer_64)
|
||||
node_api.update_node_content (l_user.id, u_node.id, u_node.content)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
redirect_to (req.absolute_script_url (""), res)
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
@@ -126,7 +126,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
feature -- Error
|
||||
|
||||
@@ -111,10 +111,10 @@ feature -- HTTP Methods
|
||||
update_node_from_data_form (req, u_node)
|
||||
u_node.set_author (l_user)
|
||||
node_api.new_node (u_node)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
redirect_to (req.absolute_script_url (""), res)
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -131,7 +131,7 @@ feature -- HTTP Methods
|
||||
update_node_from_data_form (req, l_node)
|
||||
l_node.set_author (l_user)
|
||||
node_api.update_node (l_node)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
redirect_to (req.absolute_script_url (""), res)
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
@@ -139,7 +139,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,7 +153,7 @@ feature -- HTTP Methods
|
||||
attached node_api.node (l_id.integer_value) as l_node
|
||||
then
|
||||
node_api.delete_node (l_node)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url ("")))
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
@@ -161,7 +161,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -196,7 +196,7 @@ feature {NONE} -- Node
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.execute
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,7 +102,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,7 +117,7 @@ feature -- HTTP Methods
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.value.to_integer_64)
|
||||
node_api.update_node_summary (l_user.id,u_node.id, u_node.summary)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
redirect_to (req.absolute_script_url (""), res)
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
@@ -125,7 +125,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,7 +117,7 @@ feature -- HTTP Methods
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.value.to_integer_64)
|
||||
node_api.update_node_title (l_user.id, u_node.id, u_node.title)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
redirect_to (req.absolute_script_url (""), res)
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
@@ -125,7 +125,7 @@ feature -- HTTP Methods
|
||||
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
send_access_denied (res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {NODES_HANDLER}."
|
||||
description: "Request handler related to /nodes."
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
@@ -38,12 +38,40 @@ feature -- HTTP Methods
|
||||
-- <Precursor>
|
||||
local
|
||||
l_page: CMS_RESPONSE
|
||||
s: STRING
|
||||
l_user: CMS_USER
|
||||
l_node: CMS_NODE
|
||||
do
|
||||
-- At the moment the template is hardcoded, but we can
|
||||
-- get them from the configuration file and load them into
|
||||
-- the setup class.
|
||||
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.add_variable (node_api.nodes, "nodes")
|
||||
|
||||
|
||||
-- NOTE: for development purposes we have the following hardcode output.
|
||||
create s.make_from_string ("<p>Nodes:</p>")
|
||||
if attached node_api.nodes as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
s.append ("<li>")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.script_url ("/node/" + ic.item.id.out))
|
||||
s.append ("%">")
|
||||
s.append (api.html_encoded (ic.item.title))
|
||||
s.append (" (")
|
||||
s.append (ic.item.id.out)
|
||||
s.append (")")
|
||||
s.append ("</a>")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
end
|
||||
|
||||
l_page.set_main_content (s)
|
||||
l_page.add_block (create {CMS_CONTENT_BLOCK}.make ("nodes_warning", Void, "/nodes/ is not yet fully implemented<br/>", Void), "highlighted")
|
||||
l_page.execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -73,7 +73,7 @@ feature {NONE} -- Implementation: routes
|
||||
l_methods.enable_put
|
||||
l_methods.enable_delete
|
||||
a_router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/nodes/", create {WSF_URI_AGENT_HANDLER}.make (agent do_get_nodes (?,?, a_api, a_node_api)), a_router.methods_get)
|
||||
-- a_router.handle_with_request_methods ("/nodes/", create {WSF_URI_AGENT_HANDLER}.make (agent do_get_nodes (?,?, a_api, a_node_api)), a_router.methods_get)
|
||||
end
|
||||
|
||||
configure_api_nodes (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER)
|
||||
@@ -97,7 +97,7 @@ feature {NONE} -- Implementation: routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/field/summary", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_node_title (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER)
|
||||
@@ -110,7 +110,7 @@ feature {NONE} -- Implementation: routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/field/title", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_node_content (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER)
|
||||
@@ -123,7 +123,7 @@ feature {NONE} -- Implementation: routes
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/node/{id}/field/content", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
@@ -156,50 +156,4 @@ feature -- Hooks
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
do_get_nodes (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: CMS_API; a_node_api: CMS_NODE_API)
|
||||
local
|
||||
r: CMS_RESPONSE
|
||||
s: STRING
|
||||
l_user: CMS_USER
|
||||
l_node: CMS_NODE
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api)
|
||||
|
||||
if attached a_api.user_api.user_by_name ("foo") as u then
|
||||
l_user := u
|
||||
else
|
||||
create l_user.make ("foo")
|
||||
l_user.set_password ("foobar#")
|
||||
l_user.set_email ("test@example.com")
|
||||
a_api.user_api.new_user (l_user)
|
||||
end
|
||||
if a_node_api.nodes_count = 0 then
|
||||
if l_user /= Void then
|
||||
create l_node.make ({STRING_32} "This is a content", {STRING_32} "And a summary", {STRING_32} "Nice title")
|
||||
l_node.set_author (l_user)
|
||||
a_node_api.new_node (l_node)
|
||||
end
|
||||
end
|
||||
|
||||
create s.make_from_string ("<p>Nodes:</p>")
|
||||
if attached a_node_api.nodes as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
s.append ("<li>")
|
||||
s.append (a_api.html_encoded (ic.item.title))
|
||||
s.append (" (")
|
||||
s.append (ic.item.id.out)
|
||||
s.append (")")
|
||||
s.append ("</li>%N")
|
||||
end
|
||||
end
|
||||
|
||||
r.set_main_content (s)
|
||||
r.add_block (create {CMS_CONTENT_BLOCK}.make ("nodes_warning", Void, "/nodes/ is not yet fully implemented<br/>", Void), "highlighted")
|
||||
r.execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ feature -- Access
|
||||
-- Logger
|
||||
|
||||
storage: CMS_STORAGE
|
||||
-- Persistence storage.
|
||||
-- Default persistence storage.
|
||||
|
||||
feature -- Status Report
|
||||
|
||||
|
||||
@@ -6,49 +6,53 @@ note
|
||||
even for a specific handler.
|
||||
]"
|
||||
|
||||
deferred class
|
||||
CMS_EXECUTION
|
||||
class
|
||||
CMS_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_FILTERED_ROUTED_SKELETON_EXECUTION
|
||||
WSF_ROUTED_SKELETON_SERVICE
|
||||
rename
|
||||
execute as execute_service
|
||||
undefine
|
||||
requires_proxy
|
||||
redefine
|
||||
execute_default,
|
||||
filter_execute,
|
||||
initialize
|
||||
execute_default
|
||||
end
|
||||
|
||||
WSF_FILTERED_SERVICE
|
||||
|
||||
WSF_FILTER
|
||||
rename
|
||||
execute as execute_filter
|
||||
end
|
||||
|
||||
WSF_NO_PROXY_POLICY
|
||||
|
||||
WSF_URI_HELPER_FOR_ROUTED_EXECUTION
|
||||
WSF_URI_HELPER_FOR_ROUTED_SERVICE
|
||||
|
||||
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION
|
||||
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
--create
|
||||
-- make
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
make (a_api: CMS_API)
|
||||
-- Build a CMS service with `a_api'
|
||||
do
|
||||
initialize_cms (cms_setup)
|
||||
Precursor
|
||||
api := a_api
|
||||
initialize
|
||||
ensure
|
||||
api_set: api = a_api
|
||||
end
|
||||
|
||||
initialize_cms (a_setup: CMS_SETUP)
|
||||
initialize
|
||||
-- Initialize various parts of the CMS service.
|
||||
do
|
||||
setup := a_setup
|
||||
write_debug_log (generator + ".initialize_cms")
|
||||
setup_modules (a_setup)
|
||||
create api.make (a_setup)
|
||||
|
||||
-- CMS Initialization
|
||||
initialize_modules
|
||||
initialize_users
|
||||
initialize_auth_engine
|
||||
@@ -84,17 +88,6 @@ feature {NONE} -- Initialization
|
||||
to_implement ("To Implement authentication engine")
|
||||
end
|
||||
|
||||
feature -- CMS setup
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
-- Setup additional modules.
|
||||
deferred
|
||||
end
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Settings: router
|
||||
|
||||
setup_router
|
||||
@@ -162,12 +155,12 @@ feature -- Settings: router
|
||||
|
||||
feature -- Execute Filter
|
||||
|
||||
filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the filter.
|
||||
do
|
||||
res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string)
|
||||
res.put_header_line ("X-EWF-Server: CMS_v1.0")
|
||||
Precursor (req, res)
|
||||
execute_service (req, res)
|
||||
end
|
||||
|
||||
feature -- Filters
|
||||
@@ -232,27 +225,13 @@ feature -- Filters
|
||||
|
||||
feature -- Access
|
||||
|
||||
layout: CMS_LAYOUT
|
||||
|
||||
api: CMS_API
|
||||
-- API service.
|
||||
|
||||
setup: CMS_SETUP
|
||||
|
||||
cms_setup: CMS_DEFAULT_SETUP
|
||||
setup: CMS_SETUP
|
||||
-- CMS setup.
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached execution_environment.arguments.separate_character_option_value ('d') as l_dir then
|
||||
create layout.make_with_directory_name (l_dir)
|
||||
else
|
||||
create layout.make_default
|
||||
end
|
||||
initialize_logger (layout)
|
||||
write_debug_log (generator + ".cms_setup based directory %"" + utf.escaped_utf_32_string_to_utf_8_string_8 (layout.path.name) + "%"")
|
||||
create Result.make (layout)
|
||||
setup_storage (Result)
|
||||
Result := api.setup
|
||||
end
|
||||
|
||||
modules: CMS_MODULE_COLLECTION
|
||||
@@ -1,6 +1,7 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HANDLER}."
|
||||
author: ""
|
||||
description: "[
|
||||
Common interface for request handler specific to the CMS component.
|
||||
]"
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
@@ -26,4 +27,19 @@ feature -- API Service
|
||||
|
||||
api: CMS_API
|
||||
|
||||
feature -- Response helpers
|
||||
|
||||
redirect_to (a_location: READABLE_STRING_8; res: WSF_RESPONSE)
|
||||
-- Send via `res' a redirection message for location `a_location'.
|
||||
do
|
||||
res.redirect_now (a_location)
|
||||
-- res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (a_location))
|
||||
end
|
||||
|
||||
send_access_denied (res: WSF_RESPONSE)
|
||||
-- Send via `res' an access denied response.
|
||||
do
|
||||
res.send (create {CMS_FORBIDDEN_RESPONSE_MESSAGE}.make)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {CMS_REQUEST_UTIL}."
|
||||
author: ""
|
||||
description: "Set of helper features related to CMS Request needs."
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
@@ -29,7 +28,7 @@ feature -- User
|
||||
note
|
||||
EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
|
||||
do
|
||||
if attached {CMS_USER} req.execution_variable ("_cms_active_user_") as l_user then
|
||||
if attached {CMS_USER} req.execution_variable (current_user_execution_variable_name) as l_user then
|
||||
Result := l_user
|
||||
end
|
||||
end
|
||||
@@ -40,14 +39,27 @@ feature -- Change
|
||||
-- Set `a_user' as `current_user'.
|
||||
do
|
||||
if a_user = Void then
|
||||
req.unset_execution_variable ("_cms_active_user_")
|
||||
req.unset_execution_variable (current_user_execution_variable_name)
|
||||
else
|
||||
req.set_execution_variable ("_cms_active_user_", a_user)
|
||||
req.set_execution_variable (current_user_execution_variable_name, a_user)
|
||||
end
|
||||
ensure
|
||||
user_set: current_user (req) ~ a_user
|
||||
end
|
||||
|
||||
unset_current_user (req: WSF_REQUEST)
|
||||
-- Unset current user.
|
||||
do
|
||||
req.unset_execution_variable (current_user_execution_variable_name)
|
||||
ensure
|
||||
user_unset: current_user (req) = Void
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: current user
|
||||
|
||||
current_user_execution_variable_name: STRING = "_cms_active_user_"
|
||||
-- Execution variable name used to keep current user data.
|
||||
|
||||
feature -- Media Type
|
||||
|
||||
current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32
|
||||
|
||||
25
src/service/response/cms_forbidden_response_message.e
Normal file
25
src/service/response/cms_forbidden_response_message.e
Normal file
@@ -0,0 +1,25 @@
|
||||
note
|
||||
description: "[
|
||||
Message response to notify a forbidden access.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORBIDDEN_RESPONSE_MESSAGE
|
||||
|
||||
inherit
|
||||
CMS_RESPONSE_MESSAGE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
initialize
|
||||
status_code := {HTTP_STATUS_CODE}.forbidden
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,61 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_GENERIC_RESPONSE}."
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_GENERIC_RESPONSE
|
||||
|
||||
feature -- Responses
|
||||
|
||||
new_response_redirect (req: WSF_REQUEST; res: WSF_RESPONSE; a_location: READABLE_STRING_32)
|
||||
-- Redirect to `a_location'
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_html
|
||||
h.put_current_date
|
||||
h.put_location (a_location)
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.see_other)
|
||||
res.put_header_text (h.string)
|
||||
end
|
||||
|
||||
new_response_authenticate (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Handle authenticate.
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_html
|
||||
h.put_current_date
|
||||
h.put_header_key_value ({HTTP_HEADER_NAMES}.header_www_authenticate, "Basic realm=%"CMSRoc-User%"")
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||
res.put_header_text (h.string)
|
||||
end
|
||||
|
||||
new_response_denied (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Handle access denied.
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_html
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||
res.put_header_text (h.string)
|
||||
end
|
||||
|
||||
new_response_unauthorized (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Handle not authorized.
|
||||
local
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
create h.make
|
||||
h.put_content_type_text_html
|
||||
h.put_current_date
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.forbidden)
|
||||
res.put_header_text (h.string)
|
||||
end
|
||||
|
||||
end
|
||||
26
src/service/response/cms_redirection_response_message.e
Normal file
26
src/service/response/cms_redirection_response_message.e
Normal file
@@ -0,0 +1,26 @@
|
||||
note
|
||||
description: "[
|
||||
Message response to redirect client to new location.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_REDIRECTION_RESPONSE_MESSAGE
|
||||
|
||||
inherit
|
||||
CMS_RESPONSE_MESSAGE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_location: READABLE_STRING_8)
|
||||
do
|
||||
initialize
|
||||
status_code := {HTTP_STATUS_CODE}.see_other
|
||||
header.put_location (a_location)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,8 @@
|
||||
note
|
||||
description: "Generic CMS Response.It builds the content to get process to render the output"
|
||||
description: "[
|
||||
Generic CMS Response.
|
||||
It builds the content to get process to render the output.
|
||||
]"
|
||||
date: "$Date: 2015-02-16 20:14:19 +0100 (lun., 16 févr. 2015) $"
|
||||
revision: "$Revision: 96643 $"
|
||||
|
||||
@@ -79,6 +82,9 @@ feature -- Access
|
||||
additional_page_head_lines: detachable LIST [READABLE_STRING_8]
|
||||
-- HTML>head>...extra lines
|
||||
|
||||
redirection: detachable READABLE_STRING_8
|
||||
-- Location for eventual redirection.
|
||||
|
||||
feature -- Module
|
||||
|
||||
module_resource_path (a_module: CMS_MODULE; a_resource: PATH): detachable PATH
|
||||
@@ -239,6 +245,11 @@ feature -- Element change
|
||||
values.remove (k)
|
||||
end
|
||||
|
||||
set_redirection (a_location: READABLE_STRING_8)
|
||||
-- Set `redirection' to `a_location'.
|
||||
do
|
||||
redirection := a_location
|
||||
end
|
||||
|
||||
feature -- Logging
|
||||
|
||||
@@ -247,7 +258,7 @@ feature -- Logging
|
||||
-- l_log: CMS_LOG
|
||||
do
|
||||
debug
|
||||
to_implement ("Add implemenatation")
|
||||
to_implement ("Add implementation")
|
||||
end
|
||||
-- create l_log.make (a_category, a_message, a_level, Void)
|
||||
-- if a_link /= Void then
|
||||
@@ -964,8 +975,7 @@ feature -- Generation
|
||||
feature -- Custom Variables
|
||||
|
||||
variables: detachable STRING_TABLE[ANY]
|
||||
-- Custom variables to feed the templates.
|
||||
|
||||
-- Custom variables to feed the templates.
|
||||
|
||||
feature -- Element change: Add custom variables.
|
||||
|
||||
@@ -981,7 +991,6 @@ feature -- Element change: Add custom variables.
|
||||
l_variables.force (a_element, a_key)
|
||||
end
|
||||
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
@@ -1006,6 +1015,7 @@ feature {NONE} -- Execution
|
||||
cms_page: CMS_HTML_PAGE
|
||||
page: CMS_HTML_PAGE_RESPONSE
|
||||
utf: UTF_CONVERTER
|
||||
h: HTTP_HEADER
|
||||
do
|
||||
if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then
|
||||
create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type))
|
||||
@@ -1015,8 +1025,13 @@ 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
|
||||
h := page.header
|
||||
h.put_content_length (page.html.count)
|
||||
h.put_current_date
|
||||
h.put_header_object (header)
|
||||
if attached redirection as l_location then
|
||||
h.put_location (l_location)
|
||||
end
|
||||
response.send (page)
|
||||
on_terminated
|
||||
end
|
||||
|
||||
53
src/service/response/cms_response_message.e
Normal file
53
src/service/response/cms_response_message.e
Normal file
@@ -0,0 +1,53 @@
|
||||
note
|
||||
description: "Response message interface specific to the CMS component."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_RESPONSE_MESSAGE
|
||||
|
||||
inherit
|
||||
WSF_RESPONSE_MESSAGE
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
create header.make_with_count (2)
|
||||
header.put_current_date
|
||||
header.put_content_type_text_html
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
status_code: INTEGER
|
||||
-- Status code for the response.
|
||||
|
||||
header: HTTP_HEADER
|
||||
-- Header associated with the response.
|
||||
|
||||
feature {WSF_RESPONSE} -- Output
|
||||
|
||||
send_to (res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
res.set_status_code (status_code)
|
||||
|
||||
send_header_to (res)
|
||||
send_payload_to (res)
|
||||
end
|
||||
|
||||
send_header_to (res: WSF_RESPONSE)
|
||||
-- Send header to response `res'.
|
||||
do
|
||||
res.put_header_lines (header)
|
||||
end
|
||||
|
||||
send_payload_to (res: WSF_RESPONSE)
|
||||
-- Send payload data to response `res'.
|
||||
do
|
||||
-- Nothing by default
|
||||
end
|
||||
|
||||
end
|
||||
43
src/service/response/cms_unauthorized_response_message.e
Normal file
43
src/service/response/cms_unauthorized_response_message.e
Normal file
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description: "[
|
||||
Message response to notify an unauthorized access.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_UNAUTHORIZED_RESPONSE_MESSAGE
|
||||
|
||||
inherit
|
||||
CMS_RESPONSE_MESSAGE
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_basic_auth_challenge
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
initialize
|
||||
status_code := {HTTP_STATUS_CODE}.unauthorized
|
||||
end
|
||||
|
||||
make_with_basic_auth_challenge (a_realm: detachable READABLE_STRING_8)
|
||||
local
|
||||
l_realm: READABLE_STRING_8
|
||||
do
|
||||
make
|
||||
if a_realm /= Void then
|
||||
l_realm := a_realm
|
||||
else
|
||||
l_realm := default_realm
|
||||
end
|
||||
header.put_header_key_value ({HTTP_HEADER_NAMES}.header_www_authenticate, "Basic realm=%""+ l_realm +"%"")
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
default_realm: STRING = "CMS-User credential"
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user