Compare commits

..

2 Commits

Author SHA1 Message Date
7c1d1325eb Adapt to EWF concurrent version. 2015-04-02 18:38:12 +02:00
8382edf9d7 Adapted ROC cms library and example to upcoming concurrency compliant EWF.
(SCOOP support)
2015-03-25 22:32:10 +01:00
36 changed files with 367 additions and 485 deletions

View File

@@ -8,19 +8,19 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="config" location=".\library\configuration\config-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="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/> <library name="error" location="$EWF_LIBRARY\library\utility\general\error\error-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/> <library name="http" location="$EWF_LIBRARY\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="http_authorization" location="$EWF_LIBRARY\library\server\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="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="layout" location=".\library\layout\layout-safe.ecf"/>
<library name="cms_model" location=".\library\model\cms_model-safe.ecf" readonly="false"/> <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="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="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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/> <library name="wsf" location="$EWF_LIBRARY\library\server\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_extension" location="$EWF_LIBRARY\library\server\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"/> <library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"> <cluster name="src" location=".\src\" recursive="true">
<file_rule> <file_rule>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>

14
cms.ecf
View File

@@ -8,19 +8,19 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="config" location=".\library\configuration\config.ecf"/> <library name="config" location=".\library\configuration\config.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/> <library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf" readonly="false"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/> <library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/> <library name="http" location="$EWF_LIBRARY\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="http_authorization" location="$EWF_LIBRARY\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="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="layout" location=".\library\layout\layout.ecf"/> <library name="layout" location=".\library\layout\layout.ecf"/>
<library name="cms_model" location=".\library\model\cms_model.ecf" readonly="false"/> <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="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="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="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/> <library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/> <library name="wsf_extension" location="$EWF_LIBRARY\library\server\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"/> <library name="wsf_html" location="$EWF_LIBRARY\library\server\wsf_html\wsf_html.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"> <cluster name="src" location=".\src\" recursive="true">
<file_rule> <file_rule>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>

View File

@@ -9,43 +9,50 @@
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional"> <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"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="concurrency" value="none"/> <setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/> <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_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="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\library\layout\layout-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="persistence_sqlite" location="..\..\library\persistence\sqlite\persistence_sqlite-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/> <library name="wsf" location="$EWF_LIBRARY\library\server\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_extension" location="$EWF_LIBRARY\library\server\wsf\wsf_extension-safe.ecf" readonly="false"/>
</target> </target>
<target name="demo_any" extends="common"> <target name="demo_any" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/> <setting name="concurrency" value="scoop"/>
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/> <library name="cgi" location="$EWF_LIBRARY\library\server\wsf\connector\cgi-safe.ecf"/>
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-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"/>
<cluster name="launcher" location=".\launcher\any\" recursive="true"/> <cluster name="launcher" location=".\launcher\any\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </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"> <target name="demo_nino" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="none"/> <setting name="concurrency" value="none"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/> <library name="default_nino" location="$EWF_LIBRARY\library\server\wsf\default\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/> <cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_cgi" extends="common"> <target name="demo_cgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/> <library name="default_cgi" location="$EWF_LIBRARY\library\server\wsf\default\cgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/> <cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_libfcgi" extends="common"> <target name="demo_libfcgi" extends="common">
<root class="EWF_ROC_SERVER" feature="make_and_launch"/> <root class="EWF_ROC_SERVER" feature="make_and_launch"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/> <library name="default_libfcgi" location="$EWF_LIBRARY\library\server\wsf\default\libfcgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/> <cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>

View File

@@ -1,2 +1,2 @@
port=8099 port=9090
#verbose=true #verbose=true

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $" revision: "$Revision: 36 $"
class class
APPLICATION_LAUNCHER APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit inherit
APPLICATION_LAUNCHER_I APPLICATION_LAUNCHER_I [G]
feature -- Custom feature -- Custom

View File

@@ -10,24 +10,28 @@ note
revision: "$Revision: 36 $" revision: "$Revision: 36 $"
deferred class deferred class
APPLICATION_LAUNCHER_I APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
inherit inherit
SHARED_EXECUTION_ENVIRONMENT SHARED_EXECUTION_ENVIRONMENT
feature -- Execution feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
nature: like launcher_nature nature: like launcher_nature
do do
nature := launcher_nature nature := launcher_nature
if nature = Void or else nature = nature_nino then if nature = Void then
launch_nino (a_service, opts) launch_standalone (opts)
elseif nature = nature_standalone then
launch_standalone (opts)
elseif nature = nature_nino then
launch_nino (opts)
elseif nature = nature_cgi then elseif nature = nature_cgi then
launch_cgi (a_service, opts) launch_cgi (opts)
elseif nature = nature_libfcgi then elseif nature = nature_libfcgi then
launch_libfcgi (a_service, opts) launch_libfcgi (opts)
else else
-- bye bye -- bye bye
(create {EXCEPTIONS}).die (-1) (create {EXCEPTIONS}).die (-1)
@@ -43,14 +47,16 @@ feature {NONE} -- Access
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time. --| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local local
p: PATH p: PATH
l_entry_name: READABLE_STRING_32
ext: detachable READABLE_STRING_32 ext: detachable READABLE_STRING_32
do do
create p.make_from_string (execution_environment.arguments.command_name) create p.make_from_string (execution_environment.arguments.command_name)
if attached p.entry as l_entry then if attached p.entry as l_entry then
ext := l_entry.extension ext := l_entry.extension
end end
if ext /= Void then if ext /= Void then
if ext.same_string (nature_standalone) then
Result := nature_standalone
end
if ext.same_string (nature_nino) then if ext.same_string (nature_nino) then
Result := nature_nino Result := nature_nino
end end
@@ -61,39 +67,58 @@ feature {NONE} -- Access
Result := nature_libfcgi Result := nature_libfcgi
end end
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 end
feature {NONE} -- nino feature {NONE} -- nino
nature_nino: STRING = "nino" nature_nino: STRING = "nino"
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
launcher: WSF_NINO_SERVICE_LAUNCHER launcher: WSF_NINO_SERVICE_LAUNCHER [G]
do do
create launcher.make_and_launch (a_service, opts) create launcher.make_and_launch (opts)
end end
feature {NONE} -- cgi feature {NONE} -- cgi
nature_cgi: STRING = "cgi" nature_cgi: STRING = "cgi"
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
launcher: WSF_CGI_SERVICE_LAUNCHER launcher: WSF_CGI_SERVICE_LAUNCHER [G]
do do
create launcher.make_and_launch (a_service, opts) create launcher.make_and_launch (opts)
end end
feature {NONE} -- libfcgi feature {NONE} -- libfcgi
nature_libfcgi: STRING = "libfcgi" nature_libfcgi: STRING = "libfcgi"
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
do do
create launcher.make_and_launch (a_service, opts) create launcher.make_and_launch (opts)
end
feature -- Default
default_nature: STRING
do
Result := nature_standalone
end end

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $" revision: "$Revision: 36 $"
class class
APPLICATION_LAUNCHER APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit inherit
APPLICATION_LAUNCHER_I APPLICATION_LAUNCHER_I [G]
feature -- Custom feature -- Custom

View File

@@ -10,15 +10,15 @@ note
revision: "$Revision: 96596 $" revision: "$Revision: 96596 $"
deferred class deferred class
APPLICATION_LAUNCHER_I APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
feature -- Execution feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
launcher: WSF_DEFAULT_SERVICE_LAUNCHER launcher: WSF_DEFAULT_SERVICE_LAUNCHER [G]
do do
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts) create launcher.make_and_launch (opts)
end end
end end

View File

@@ -13,11 +13,11 @@
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/> <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" location="..\..\..\..\cms-safe.ecf" readonly="false"/>
<library name="cms_model" location="..\..\..\..\library\model\cms_model-safe.ecf" readonly="false"/> <library name="cms_model" location="..\..\..\..\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/> <library name="http" location="$EWF_LIBRARY\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="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="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/> <library name="wsf" location="$EWF_LIBRARY\library\server\wsf\wsf-safe.ecf"/>
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/> <library name="wsf_encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<cluster name="src" location=".\" recursive="true"/> <cluster name="src" location=".\" recursive="true"/>
</target> </target>
</system> </system>

View File

@@ -1,13 +1,10 @@
{ {
"database": { "database": {
"datasource": { "datasource": {
"driver": "sqlite", "driver": "MySQL",
"environment": "sqlite" "environment": "development"
}, },
"environments": { "environments": {
"sqlite": {
"connection_string":"Driver=SQLite3 ODBC Driver;Database=./site/database.sqlite;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
},
"test": { "test": {
"connection_string":"Server=localhost;Port=3306;Database=cms_dev;Uid=root;Pwd=;" "connection_string":"Server=localhost;Port=3306;Database=cms_dev;Uid=root;Pwd=;"
}, },
@@ -32,4 +29,4 @@
} }

View File

@@ -16,17 +16,10 @@ inherit
initialize initialize
end end
WSF_SERVICE
redefine
execute
end
REFACTORING_HELPER REFACTORING_HELPER
SHARED_EXECUTION_ENVIRONMENT SHARED_EXECUTION_ENVIRONMENT
SHARED_LOGGER
create create
make_and_launch make_and_launch
@@ -43,36 +36,19 @@ feature {NONE} -- Initialization
do do
Precursor Precursor
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini") create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
initialize_cms (cms_setup)
end 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 feature {NONE} -- Launch operation
launcher: APPLICATION_LAUNCHER launcher: APPLICATION_LAUNCHER [EWF_ROC_SERVER_EXECUTION]
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local local
l_retry: BOOLEAN l_retry: BOOLEAN
l_message: STRING l_message: STRING
do do
if not l_retry then if not l_retry then
write_debug_log (generator + ".launch") launcher.launch (opts)
launcher.launch (a_service, opts)
else else
-- error hanling. -- error hanling.
create l_message.make (1024) create l_message.make (1024)
@@ -92,68 +68,11 @@ feature {NONE} -- Launch operation
l_message.append ("%N%N") l_message.append ("%N%N")
end end
-- send email shutdown -- send email shutdown
write_debug_log (generator + ".launch shutdown")
end end
rescue rescue
l_retry := True l_retry := True
retry retry
end 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 end

View File

@@ -0,0 +1,57 @@
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

View File

@@ -14,17 +14,10 @@ inherit
REFACTORING_HELPER REFACTORING_HELPER
create create
make, make
make_empty
feature{NONE} -- Initialization 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) 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'. -- Create current node with `a_content', `a_summary' and `a_title'.
local local
@@ -90,6 +83,9 @@ feature -- Access
author: detachable CMS_USER author: detachable CMS_USER
-- Author of current node. -- Author of current node.
-- collaborators: detachable LIST[CMS_USER]
-- -- Users contributed to current Node.
feature -- status report feature -- status report
has_id: BOOLEAN has_id: BOOLEAN
@@ -195,6 +191,6 @@ feature -- Element change
-- end -- end
note note
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software 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)"
end end

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\cms-safe.ecf" readonly="false"/> <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="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/> <library name="error" location="$EWF_LIBRARY\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="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="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/> <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\cms.ecf" readonly="false"/> <library name="cms" location="..\..\..\cms.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/> <library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/> <library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/> <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="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/> <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\..\cms-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="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder-safe.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/> <library name="error" location="$EWF_LIBRARY\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="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="layout" location="..\..\layout\layout-safe.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/> <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>

View File

@@ -9,8 +9,8 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="cms" location="..\..\..\cms.ecf"/> <library name="cms" location="..\..\..\cms.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/> <library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/> <library name="encoder" location="$EWF_LIBRARY\library\text\encoder\encoder.ecf"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/> <library name="error" location="$EWF_LIBRARY\library\utility\general\error\error.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/> <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="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/> <library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>

View File

@@ -1,8 +1,5 @@
note note
description: "[ description: "This module allows the use of HTTP Basic Authentication to restrict access by looking up users in the given providers."
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) $" date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
revision: "$Revision: 96596 $" revision: "$Revision: 96596 $"
@@ -85,7 +82,7 @@ feature -- Hooks configuration
-- Module hooks configuration. -- Module hooks configuration.
do do
-- a_response.subscribe_to_block_hook (Current) -- a_response.subscribe_to_block_hook (Current)
end end
feature -- Hooks feature -- Hooks
@@ -110,9 +107,9 @@ feature -- Hooks
lnk: CMS_LOCAL_LINK lnk: CMS_LOCAL_LINK
do do
if attached a_response.current_user (a_response.request) as u then if attached a_response.current_user (a_response.request) as u then
create lnk.make (u.name + " (Logout)", "/basic_auth_logoff?destination=" + a_response.request.request_uri) create lnk.make ("Logout", "/basic_auth_logoff")
else else
create lnk.make ("Login", "/basic_auth_login?destination=" + a_response.request.request_uri) create lnk.make ("Login", "/basic_auth_login")
end end
-- if not a_menu_system.primary_menu.has (lnk) then -- if not a_menu_system.primary_menu.has (lnk) then
lnk.set_weight (99) lnk.set_weight (99)

View File

@@ -50,21 +50,11 @@ feature -- HTTP Methods
do do
api.logger.put_information (generator + ".do_get Processing basic auth login", Void) api.logger.put_information (generator + ".do_get Processing basic auth login", Void)
if attached {STRING_32} current_user_name (req) as l_user then if attached {STRING_32} current_user_name (req) as l_user then
if attached {WSF_STRING} req.query_parameter ("destination") as l_uri then (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url("/"))
redirect_to (req.absolute_script_url (l_uri.url_encoded_value), res)
else
redirect_to (req.absolute_script_url ("/"), res)
end
else else
send_basic_authentication_challenge (Void, res) (create {CMS_GENERIC_RESPONSE}).new_response_authenticate (req, res)
end end
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 end

View File

@@ -45,29 +45,13 @@ feature -- HTTP Methods
-- <Precursor> -- <Precursor>
local local
l_page: CMS_RESPONSE l_page: CMS_RESPONSE
l_url: STRING
i: INTEGER
do do
api.logger.put_information (generator + ".do_get Processing basic auth logoff", Void) api.logger.put_information (generator + ".do_get Processing basic auth logoff", Void)
if attached req.query_parameter ("prompt") as l_prompt then if attached req.query_parameter ("prompt") as l_prompt then
unset_current_user (req) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
send_access_denied (res)
else else
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
unset_current_user (req) l_page.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
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 l_page.execute
end end
end end

View File

@@ -77,7 +77,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -102,7 +102,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -118,7 +118,7 @@ feature -- HTTP Methods
u_node := extract_data_form (req) u_node := extract_data_form (req)
u_node.set_id (l_id.value.to_integer_64) u_node.set_id (l_id.value.to_integer_64)
node_api.update_node_content (l_user.id, u_node.id, u_node.content) node_api.update_node_content (l_user.id, u_node.id, u_node.content)
redirect_to (req.absolute_script_url (""), res) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else else
do_error (req, res, l_id) do_error (req, res, l_id)
end end
@@ -126,7 +126,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
feature -- Error feature -- Error

View File

@@ -111,10 +111,10 @@ feature -- HTTP Methods
update_node_from_data_form (req, u_node) update_node_from_data_form (req, u_node)
u_node.set_author (l_user) u_node.set_author (l_user)
node_api.new_node (u_node) node_api.new_node (u_node)
redirect_to (req.absolute_script_url (""), res) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -131,7 +131,7 @@ feature -- HTTP Methods
update_node_from_data_form (req, l_node) update_node_from_data_form (req, l_node)
l_node.set_author (l_user) l_node.set_author (l_user)
node_api.update_node (l_node) node_api.update_node (l_node)
redirect_to (req.absolute_script_url (""), res) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else else
do_error (req, res, l_id) do_error (req, res, l_id)
end end
@@ -139,7 +139,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -153,7 +153,7 @@ feature -- HTTP Methods
attached node_api.node (l_id.integer_value) as l_node attached node_api.node (l_id.integer_value) as l_node
then then
node_api.delete_node (l_node) node_api.delete_node (l_node)
res.send (create {CMS_REDIRECTION_RESPONSE_MESSAGE}.make (req.absolute_script_url (""))) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else else
do_error (req, res, l_id) do_error (req, res, l_id)
end end
@@ -161,7 +161,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -196,7 +196,7 @@ feature {NONE} -- Node
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
l_page.execute l_page.execute
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end

View File

@@ -77,7 +77,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -102,7 +102,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -117,7 +117,7 @@ feature -- HTTP Methods
u_node := extract_data_form (req) u_node := extract_data_form (req)
u_node.set_id (l_id.value.to_integer_64) u_node.set_id (l_id.value.to_integer_64)
node_api.update_node_summary (l_user.id,u_node.id, u_node.summary) node_api.update_node_summary (l_user.id,u_node.id, u_node.summary)
redirect_to (req.absolute_script_url (""), res) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else else
do_error (req, res, l_id) do_error (req, res, l_id)
end end
@@ -125,7 +125,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end

View File

@@ -77,7 +77,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -101,7 +101,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end
@@ -117,7 +117,7 @@ feature -- HTTP Methods
u_node := extract_data_form (req) u_node := extract_data_form (req)
u_node.set_id (l_id.value.to_integer_64) u_node.set_id (l_id.value.to_integer_64)
node_api.update_node_title (l_user.id, u_node.id, u_node.title) node_api.update_node_title (l_user.id, u_node.id, u_node.title)
redirect_to (req.absolute_script_url (""), res) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else else
do_error (req, res, l_id) do_error (req, res, l_id)
end end
@@ -125,7 +125,7 @@ feature -- HTTP Methods
(create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute
end end
else else
send_access_denied (res) (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end end
end end

View File

@@ -1,5 +1,5 @@
note note
description: "Request handler related to /nodes." description: "Summary description for {NODES_HANDLER}."
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $" revision: "$Revision: 96616 $"
@@ -38,40 +38,12 @@ feature -- HTTP Methods
-- <Precursor> -- <Precursor>
local local
l_page: CMS_RESPONSE l_page: CMS_RESPONSE
s: STRING
l_user: CMS_USER
l_node: CMS_NODE
do do
-- At the moment the template is hardcoded, but we can -- At the moment the template is hardcoded, but we can
-- get them from the configuration file and load them into -- get them from the configuration file and load them into
-- the setup class. -- the setup class.
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
l_page.add_variable (node_api.nodes, "nodes") 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 l_page.execute
end end
end end

View File

@@ -73,7 +73,7 @@ feature {NONE} -- Implementation: routes
l_methods.enable_put l_methods.enable_put
l_methods.enable_delete l_methods.enable_delete
a_router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods) 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 end
configure_api_nodes (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) 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_get
l_methods.enable_post l_methods.enable_post
l_methods.enable_put l_methods.enable_put
a_router.handle_with_request_methods ("/node/{id}/field/summary", l_report_handler, l_methods) a_router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
end end
configure_api_node_title (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) 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_get
l_methods.enable_post l_methods.enable_post
l_methods.enable_put l_methods.enable_put
a_router.handle_with_request_methods ("/node/{id}/field/title", l_report_handler, l_methods) a_router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
end end
configure_api_node_content (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) 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_get
l_methods.enable_post l_methods.enable_post
l_methods.enable_put l_methods.enable_put
a_router.handle_with_request_methods ("/node/{id}/field/content", l_report_handler, l_methods) a_router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
end end
feature -- Hooks feature -- Hooks
@@ -156,4 +156,50 @@ feature -- Hooks
a_menu_system.primary_menu.extend (lnk) a_menu_system.primary_menu.extend (lnk)
end 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 end

View File

@@ -50,7 +50,7 @@ feature -- Access
-- Logger -- Logger
storage: CMS_STORAGE storage: CMS_STORAGE
-- Default persistence storage. -- Persistence storage.
feature -- Status Report feature -- Status Report

View File

@@ -6,53 +6,49 @@ note
even for a specific handler. even for a specific handler.
]" ]"
class deferred class
CMS_SERVICE CMS_EXECUTION
inherit inherit
WSF_ROUTED_SKELETON_SERVICE WSF_FILTERED_ROUTED_SKELETON_EXECUTION
rename
execute as execute_service
undefine undefine
requires_proxy requires_proxy
redefine redefine
execute_default execute_default,
end filter_execute,
initialize
WSF_FILTERED_SERVICE
WSF_FILTER
rename
execute as execute_filter
end end
WSF_NO_PROXY_POLICY WSF_NO_PROXY_POLICY
WSF_URI_HELPER_FOR_ROUTED_SERVICE WSF_URI_HELPER_FOR_ROUTED_EXECUTION
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_EXECUTION
REFACTORING_HELPER REFACTORING_HELPER
SHARED_LOGGER SHARED_LOGGER
create --create
make -- make
feature {NONE} -- Initialization feature {NONE} -- Initialization
make (a_api: CMS_API) initialize
-- Build a CMS service with `a_api' -- Build a CMS service with `a_api'
do do
api := a_api initialize_cms (cms_setup)
initialize Precursor
ensure
api_set: api = a_api
end end
initialize initialize_cms (a_setup: CMS_SETUP)
-- Initialize various parts of the CMS service.
do do
setup := a_setup
write_debug_log (generator + ".initialize_cms")
setup_modules (a_setup)
create api.make (a_setup)
-- CMS Initialization
initialize_modules initialize_modules
initialize_users initialize_users
initialize_auth_engine initialize_auth_engine
@@ -88,6 +84,17 @@ feature {NONE} -- Initialization
to_implement ("To Implement authentication engine") to_implement ("To Implement authentication engine")
end 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 feature -- Settings: router
setup_router setup_router
@@ -155,12 +162,12 @@ feature -- Settings: router
feature -- Execute Filter feature -- Execute Filter
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE) filter_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter. -- Execute the filter.
do do
res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string) res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string)
res.put_header_line ("X-EWF-Server: CMS_v1.0") res.put_header_line ("X-EWF-Server: CMS_v1.0")
execute_service (req, res) Precursor (req, res)
end end
feature -- Filters feature -- Filters
@@ -225,13 +232,27 @@ feature -- Filters
feature -- Access feature -- Access
layout: CMS_LAYOUT
api: CMS_API api: CMS_API
-- API service. -- API service.
setup: CMS_SETUP setup: CMS_SETUP
cms_setup: CMS_DEFAULT_SETUP
-- CMS setup. -- CMS setup.
local
utf: UTF_CONVERTER
do do
Result := api.setup 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 end
modules: CMS_MODULE_COLLECTION modules: CMS_MODULE_COLLECTION

View File

@@ -1,7 +1,6 @@
note note
description: "[ description: "Summary description for {CMS_HANDLER}."
Common interface for request handler specific to the CMS component. author: ""
]"
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $" revision: "$Revision: 96616 $"
@@ -27,19 +26,4 @@ feature -- API Service
api: CMS_API 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 end

View File

@@ -1,5 +1,6 @@
note note
description: "Set of helper features related to CMS Request needs." description: "Summary description for {CMS_REQUEST_UTIL}."
author: ""
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
revision: "$Revision: 96616 $" revision: "$Revision: 96616 $"
@@ -28,7 +29,7 @@ feature -- User
note note
EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute" EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
do do
if attached {CMS_USER} req.execution_variable (current_user_execution_variable_name) as l_user then if attached {CMS_USER} req.execution_variable ("_cms_active_user_") as l_user then
Result := l_user Result := l_user
end end
end end
@@ -39,27 +40,14 @@ feature -- Change
-- Set `a_user' as `current_user'. -- Set `a_user' as `current_user'.
do do
if a_user = Void then if a_user = Void then
req.unset_execution_variable (current_user_execution_variable_name) req.unset_execution_variable ("_cms_active_user_")
else else
req.set_execution_variable (current_user_execution_variable_name, a_user) req.set_execution_variable ("_cms_active_user_", a_user)
end end
ensure ensure
user_set: current_user (req) ~ a_user user_set: current_user (req) ~ a_user
end 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 feature -- Media Type
current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32 current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32

View File

@@ -1,25 +0,0 @@
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

View File

@@ -0,0 +1,61 @@
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

View File

@@ -1,26 +0,0 @@
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

View File

@@ -1,8 +1,5 @@
note note
description: "[ description: "Generic CMS Response.It builds the content to get process to render the output"
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) $" date: "$Date: 2015-02-16 20:14:19 +0100 (lun., 16 févr. 2015) $"
revision: "$Revision: 96643 $" revision: "$Revision: 96643 $"
@@ -82,9 +79,6 @@ feature -- Access
additional_page_head_lines: detachable LIST [READABLE_STRING_8] additional_page_head_lines: detachable LIST [READABLE_STRING_8]
-- HTML>head>...extra lines -- HTML>head>...extra lines
redirection: detachable READABLE_STRING_8
-- Location for eventual redirection.
feature -- Module feature -- Module
module_resource_path (a_module: CMS_MODULE; a_resource: PATH): detachable PATH module_resource_path (a_module: CMS_MODULE; a_resource: PATH): detachable PATH
@@ -245,11 +239,6 @@ feature -- Element change
values.remove (k) values.remove (k)
end end
set_redirection (a_location: READABLE_STRING_8)
-- Set `redirection' to `a_location'.
do
redirection := a_location
end
feature -- Logging feature -- Logging
@@ -258,7 +247,7 @@ feature -- Logging
-- l_log: CMS_LOG -- l_log: CMS_LOG
do do
debug debug
to_implement ("Add implementation") to_implement ("Add implemenatation")
end end
-- create l_log.make (a_category, a_message, a_level, Void) -- create l_log.make (a_category, a_message, a_level, Void)
-- if a_link /= Void then -- if a_link /= Void then
@@ -975,7 +964,8 @@ feature -- Generation
feature -- Custom Variables feature -- Custom Variables
variables: detachable STRING_TABLE[ANY] variables: detachable STRING_TABLE[ANY]
-- Custom variables to feed the templates. -- Custom variables to feed the templates.
feature -- Element change: Add custom variables. feature -- Element change: Add custom variables.
@@ -991,6 +981,7 @@ feature -- Element change: Add custom variables.
l_variables.force (a_element, a_key) l_variables.force (a_element, a_key)
end end
feature -- Execution feature -- Execution
execute execute
@@ -1015,7 +1006,6 @@ feature {NONE} -- Execution
cms_page: CMS_HTML_PAGE cms_page: CMS_HTML_PAGE
page: CMS_HTML_PAGE_RESPONSE page: CMS_HTML_PAGE_RESPONSE
utf: UTF_CONVERTER utf: UTF_CONVERTER
h: HTTP_HEADER
do do
if attached {READABLE_STRING_GENERAL} values.item ("optional_content_type") as l_type then 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)) create cms_page.make_typed (utf.utf_32_string_to_utf_8_string_8 (l_type))
@@ -1025,13 +1015,8 @@ feature {NONE} -- Execution
prepare (cms_page) prepare (cms_page)
create page.make (theme.page_html (cms_page)) create page.make (theme.page_html (cms_page))
page.set_status_code (status_code) page.set_status_code (status_code)
h := page.header page.header.put_content_length (page.html.count)
h.put_content_length (page.html.count) page.header.put_current_date
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) response.send (page)
on_terminated on_terminated
end end

View File

@@ -1,53 +0,0 @@
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

View File

@@ -1,43 +0,0 @@
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