rsence 2.0.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL.rdoc +295 -0
- data/LICENSE +622 -0
- data/README.rdoc +24 -0
- data/VERSION +1 -0
- data/bin/build_client.rb +254 -0
- data/bin/help +6 -0
- data/bin/launch.rb +120 -0
- data/bin/rdoc.sh +2 -0
- data/bin/restart +6 -0
- data/bin/rsence +120 -0
- data/bin/run +6 -0
- data/bin/run.rb +6 -0
- data/bin/save +6 -0
- data/bin/start +6 -0
- data/bin/status +6 -0
- data/bin/stop +6 -0
- data/conf/config.ru +5 -0
- data/conf/default_conf.yaml +337 -0
- data/conf/default_strings.yaml +77 -0
- data/conf/local_conf.yaml +14 -0
- data/conf/unicorn.conf +78 -0
- data/js/comm/comm/autosync/autosync.js +18 -0
- data/js/comm/comm/autosync/js.inc +0 -0
- data/js/comm/comm/comm.js +195 -0
- data/js/comm/comm/js.inc +0 -0
- data/js/comm/comm/queue/js.inc +0 -0
- data/js/comm/comm/queue/queue.js +183 -0
- data/js/comm/comm/session/js.inc +0 -0
- data/js/comm/comm/session/session.js +51 -0
- data/js/comm/comm/sessionwatcher/js.inc +0 -0
- data/js/comm/comm/sessionwatcher/sessionwatcher.js +43 -0
- data/js/comm/comm/transporter/js.inc +0 -0
- data/js/comm/comm/transporter/transporter.js +257 -0
- data/js/comm/comm/urlresponder/js.inc +0 -0
- data/js/comm/comm/urlresponder/urlresponder.js +148 -0
- data/js/comm/comm/values/js.inc +0 -0
- data/js/comm/comm/values/values.js +432 -0
- data/js/comm/jsloader/js.inc +0 -0
- data/js/comm/jsloader/jsloader.js +114 -0
- data/js/comm/reloadapp/js.inc +0 -0
- data/js/comm/reloadapp/reloadapp.js +150 -0
- data/js/comm/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/comm/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/comm/sha/js.inc +0 -0
- data/js/comm/sha/sha.js +432 -0
- data/js/comm/values/value/js.inc +0 -0
- data/js/comm/values/value/value.js +182 -0
- data/js/comm/values/valuematrix/js.inc +0 -0
- data/js/comm/values/valuematrix/valuematrix.js +138 -0
- data/js/controls/button/button.js +57 -0
- data/js/controls/button/js.inc +0 -0
- data/js/controls/button/themes/bright/button.css +89 -0
- data/js/controls/button/themes/bright/button.html +7 -0
- data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/bright/button_parts1.png +0 -0
- data/js/controls/button/themes/default/button.css +89 -0
- data/js/controls/button/themes/default/button.html +7 -0
- data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/default/button_parts1.png +0 -0
- data/js/controls/checkbox/checkbox.js +47 -0
- data/js/controls/checkbox/js.inc +0 -0
- data/js/controls/checkbox/themes/default/checkbox.css +69 -0
- data/js/controls/checkbox/themes/default/checkbox.html +5 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
- data/js/controls/datetime/calendar/calendar.js +197 -0
- data/js/controls/datetime/calendar/js.inc +0 -0
- data/js/controls/datetime/calendar/themes/default/calendar.css +108 -0
- data/js/controls/datetime/calendar/themes/default/calendar.html +9 -0
- data/js/controls/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/controls/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/controls/datetime/datetimevalue/datetimevalue.js +246 -0
- data/js/controls/datetime/datetimevalue/js.inc +0 -0
- data/js/controls/datetime/timesheet/js.inc +0 -0
- data/js/controls/datetime/timesheet/themes/default/timesheet.css +30 -0
- data/js/controls/datetime/timesheet/themes/default/timesheet.html +2 -0
- data/js/controls/datetime/timesheet/timesheet.js +182 -0
- data/js/controls/datetime/timesheet_item/js.inc +0 -0
- data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
- data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
- data/js/controls/datetime/timesheet_item/timesheet_item.js +247 -0
- data/js/controls/datetime/timesheet_item_edit/js.inc +0 -0
- data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +62 -0
- data/js/controls/dialogs/alert_sheet/js.inc +0 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +36 -0
- data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/sheet.js +83 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
- data/js/controls/imageview/imageview.js +108 -0
- data/js/controls/imageview/js.inc +0 -0
- data/js/controls/imageview/themes/default/blank.gif +0 -0
- data/js/controls/lists/checkboxlist/checkboxlist.js +170 -0
- data/js/controls/lists/checkboxlist/js.inc +0 -0
- data/js/controls/lists/listitems/js.inc +0 -0
- data/js/controls/lists/listitems/listitems.js +65 -0
- data/js/controls/lists/radiobuttonlist/js.inc +0 -0
- data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +126 -0
- data/js/controls/passwordcontrol/js.inc +0 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +22 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
- data/js/controls/progress/progressbar/js.inc +0 -0
- data/js/controls/progress/progressbar/progressbar.js +36 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
- data/js/controls/progress/progressindicator/js.inc +0 -0
- data/js/controls/progress/progressindicator/progressindicator.js +43 -0
- data/js/controls/radiobutton/js.inc +0 -0
- data/js/controls/radiobutton/radiobutton.js +41 -0
- data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
- data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
- data/js/controls/sliders/slider/js.inc +0 -0
- data/js/controls/sliders/slider/slider.js +356 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
- data/js/controls/sliders/slider/themes/default/slider.css +108 -0
- data/js/controls/sliders/slider/themes/default/slider.html +5 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
- data/js/controls/sliders/vslider/js.inc +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
- data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
- data/js/controls/sliders/vslider/vslider.js +40 -0
- data/js/controls/stepper/js.inc +0 -0
- data/js/controls/stepper/stepper.js +212 -0
- data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
- data/js/controls/stepper/themes/default/stepper.css +14 -0
- data/js/controls/stepper/themes/default/stepper.html +2 -0
- data/js/controls/stepper/themes/default/stepper.png +0 -0
- data/js/controls/stringview/js.inc +0 -0
- data/js/controls/stringview/stringview.js +49 -0
- data/js/controls/stringview/themes/default/stringview.css +8 -0
- data/js/controls/stringview/themes/default/stringview.html +1 -0
- data/js/controls/tab/js.inc +0 -0
- data/js/controls/tab/tab.js +276 -0
- data/js/controls/tab/themes/bright/tab.css +76 -0
- data/js/controls/tab/themes/bright/tab.html +6 -0
- data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
- data/js/controls/tab/themes/default/tab.css +77 -0
- data/js/controls/tab/themes/default/tab.html +6 -0
- data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_parts1.png +0 -0
- data/js/controls/textarea/js.inc +0 -0
- data/js/controls/textarea/textarea.js +23 -0
- data/js/controls/textarea/themes/default/textarea.css +21 -0
- data/js/controls/textarea/themes/default/textarea.html +18 -0
- data/js/controls/textcontrol/js.inc +0 -0
- data/js/controls/textcontrol/textcontrol.js +372 -0
- data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
- data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
- data/js/controls/uploader/js.inc +0 -0
- data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
- data/js/controls/uploader/themes/default/uploader.css +108 -0
- data/js/controls/uploader/themes/default/uploader.html +27 -0
- data/js/controls/uploader/uploader.js +153 -0
- data/js/controls/validatorview/js.inc +0 -0
- data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
- data/js/controls/validatorview/themes/default/validator.png +0 -0
- data/js/controls/validatorview/themes/default/validatorview.css +0 -0
- data/js/controls/validatorview/themes/default/validatorview.html +0 -0
- data/js/controls/validatorview/validatorview.js +55 -0
- data/js/controls/window/js.inc +0 -0
- data/js/controls/window/themes/default/window.css +219 -0
- data/js/controls/window/themes/default/window.html +17 -0
- data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_active.png +0 -0
- data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
- data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_buttons.png +0 -0
- data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts1.png +0 -0
- data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts2.png +0 -0
- data/js/controls/window/window.js +284 -0
- data/js/core/class/class.js +317 -0
- data/js/core/class/js.inc +0 -0
- data/js/core/elem/elem.js +1376 -0
- data/js/core/elem/js.inc +0 -0
- data/js/core/event/event.js +1021 -0
- data/js/core/event/js.inc +0 -0
- data/js/core/iefix/ie_css_element.htc +5 -0
- data/js/core/iefix/ie_css_style.htc +5 -0
- data/js/core/iefix/iefix.js +359 -0
- data/js/core/iefix/js.inc +0 -0
- data/js/debugg/debugg.js +43 -0
- data/js/debugg/js.inc +0 -0
- data/js/foundation/application/application.js +209 -0
- data/js/foundation/application/js.inc +0 -0
- data/js/foundation/control/control.js +342 -0
- data/js/foundation/control/controldefaults/controldefaults.js +59 -0
- data/js/foundation/control/controldefaults/js.inc +0 -0
- data/js/foundation/control/dummyvalue/dummyvalue.js +50 -0
- data/js/foundation/control/dummyvalue/js.inc +0 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +494 -0
- data/js/foundation/control/dyncontrol/js.inc +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
- data/js/foundation/control/eventresponder/eventresponder.js +713 -0
- data/js/foundation/control/eventresponder/js.inc +0 -0
- data/js/foundation/control/js.inc +0 -0
- data/js/foundation/control/valueresponder/js.inc +0 -0
- data/js/foundation/control/valueresponder/valueresponder.js +77 -0
- data/js/foundation/geom/point/js.inc +0 -0
- data/js/foundation/geom/point/point.js +202 -0
- data/js/foundation/geom/rect/js.inc +0 -0
- data/js/foundation/geom/rect/rect.js +610 -0
- data/js/foundation/json_renderer/js.inc +0 -0
- data/js/foundation/json_renderer/json_renderer.js +231 -0
- data/js/foundation/system/js.inc +0 -0
- data/js/foundation/system/system.js +369 -0
- data/js/foundation/thememanager/js.inc +0 -0
- data/js/foundation/thememanager/thememanager.js +387 -0
- data/js/foundation/view/js.inc +0 -0
- data/js/foundation/view/markupview/js.inc +0 -0
- data/js/foundation/view/markupview/markupview.js +113 -0
- data/js/foundation/view/morphanimation/js.inc +0 -0
- data/js/foundation/view/morphanimation/morphanimation.js +236 -0
- data/js/foundation/view/view.js +1804 -0
- data/js/foundation/view/viewdefaults/js.inc +0 -0
- data/js/foundation/view/viewdefaults/viewdefaults.js +25 -0
- data/js/views/centerview/centerview.js +45 -0
- data/js/views/centerview/js.inc +0 -0
- data/js/views/inlineview/inlineview.js +14 -0
- data/js/views/inlineview/js.inc +0 -0
- data/js/views/scrollview/js.inc +0 -0
- data/js/views/scrollview/scrollview.js +39 -0
- data/lib/conf/default.rb +220 -0
- data/lib/conf/wizard.rb +303 -0
- data/lib/daemon/daemon.rb +293 -0
- data/lib/http/broker.rb +102 -0
- data/lib/http/rackup.rb +88 -0
- data/lib/http/request.rb +69 -0
- data/lib/http/response.rb +63 -0
- data/lib/plugins/gui_plugin.rb +129 -0
- data/lib/plugins/guiparser.rb +114 -0
- data/lib/plugins/plugin.rb +652 -0
- data/lib/plugins/plugin_plugins.rb +47 -0
- data/lib/plugins/plugin_sqlite_db.rb +72 -0
- data/lib/plugins/plugin_util.rb +96 -0
- data/lib/plugins/pluginmanager.rb +517 -0
- data/lib/plugins/servlet.rb +69 -0
- data/lib/session/msg.rb +291 -0
- data/lib/session/sessionmanager.rb +491 -0
- data/lib/session/sessionstorage.rb +314 -0
- data/lib/transporter/transporter.rb +254 -0
- data/lib/util/gzstring.rb +5 -0
- data/lib/values/hvalue.rb +323 -0
- data/lib/values/valuemanager.rb +152 -0
- data/plugins/client_pkg/client_pkg.rb +186 -0
- data/plugins/client_pkg/info.yaml +25 -0
- data/plugins/client_pkg/lib/client_pkg_build.rb +569 -0
- data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
- data/plugins/client_pkg/lib/client_pkg_serve.rb +210 -0
- data/plugins/client_pkg/log/build_log +0 -0
- data/plugins/index_html/img/loading.gif +0 -0
- data/plugins/index_html/img/riassence.gif +0 -0
- data/plugins/index_html/index_html.rb +150 -0
- data/plugins/index_html/tmpl/index.html +22 -0
- data/plugins/index_html/tmpl/startup_index.html +29 -0
- data/plugins/legacy/disabled +0 -0
- data/plugins/legacy/disabled- +0 -0
- data/plugins/legacy/info.yaml +22 -0
- data/plugins/legacy/legacy.rb +15 -0
- data/plugins/main/js/riassence_ns.js +87 -0
- data/plugins/main/main.rb +234 -0
- data/plugins/main/values.yaml +8 -0
- data/plugins/ticketservices/lib/common.rb +300 -0
- data/plugins/ticketservices/lib/favicon.rb +38 -0
- data/plugins/ticketservices/lib/file.rb +58 -0
- data/plugins/ticketservices/lib/img.rb +50 -0
- data/plugins/ticketservices/lib/objblob.rb +66 -0
- data/plugins/ticketservices/lib/rsrc.rb +34 -0
- data/plugins/ticketservices/lib/upload.rb +206 -0
- data/plugins/ticketservices/ticketservices.rb +268 -0
- data/var/db/.git_include +0 -0
- data/var/log/.git_include +0 -0
- data/var/run/.git_include +0 -0
- metadata +390 -0
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
# The human-readable product name of the package
|
3
|
+
title: Legacy Compatibility Plugin
|
4
|
+
|
5
|
+
# The human-readable version of the package
|
6
|
+
version: 2.0.0
|
7
|
+
|
8
|
+
# A brief description of the package (rdoc formatting supported)
|
9
|
+
description: |
|
10
|
+
This bundle provides compatibility for older plugins that rely on
|
11
|
+
some global variables.
|
12
|
+
|
13
|
+
# A flag (when false) prevents the plugin from automatically reload when changed.
|
14
|
+
reloadable: false
|
15
|
+
|
16
|
+
# A flag (when false) enables automatic construction
|
17
|
+
# of the Plugin and Servlet classes contained.
|
18
|
+
inits_self: false
|
19
|
+
|
20
|
+
# System version requirement.
|
21
|
+
sys_version: '>= 2.0.0'
|
22
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
RSence = {
|
2
|
+
|
3
|
+
// List of apps initialized utilizing GUITrees, by GUIPlugin name
|
4
|
+
apps: { },
|
5
|
+
|
6
|
+
// Subview that utilizes GUITrees
|
7
|
+
GUIView: HControl.extend({
|
8
|
+
|
9
|
+
}),
|
10
|
+
|
11
|
+
// Application that handles GUITrees, populates its values dynamically
|
12
|
+
GUIApp: HApplication.extend({
|
13
|
+
constructor: function(_options){
|
14
|
+
|
15
|
+
var
|
16
|
+
_this = this,
|
17
|
+
|
18
|
+
// Application priority
|
19
|
+
_priority = _options.priority?_options.priority:100,
|
20
|
+
|
21
|
+
// Application label / title
|
22
|
+
_label = _options.label?_options.label:'Untitled Application',
|
23
|
+
|
24
|
+
// Application description (multiline)
|
25
|
+
_descr = _options.descr?_options.descr:'No Description',
|
26
|
+
|
27
|
+
// Allow multiple instances?
|
28
|
+
_allowMulti = _options.allowMulti?_options.allowMulti:false,
|
29
|
+
|
30
|
+
// The GUI Tree
|
31
|
+
_valueObj = _options.valueObj?_options.valueObj:false,
|
32
|
+
|
33
|
+
// Signal input (from server to client)
|
34
|
+
_sigInput = _options.sigInput?COMM.Values.values[_options.sigInput]:false,
|
35
|
+
|
36
|
+
// Signal output (from client to server)
|
37
|
+
_sigOutput = _options.sigOutput?COMM.Values.values[_options.sigOutput]:false,
|
38
|
+
|
39
|
+
// Icon image url.
|
40
|
+
// Minimum size is 16x16 and multiple sizes are stacked on top of each other,
|
41
|
+
// largest topmost, smaller versions aligned left below in size order.
|
42
|
+
// Image formats supported are: SVG (except for IE), PNG (all), GIF (all), JPG (all).
|
43
|
+
// Recommended formats are: SVG and PNG24 with transparency / translucency.
|
44
|
+
// Size has to be a factor of two; 16,32,64,128,256,512 are valid dimensions:
|
45
|
+
// 32x32 -> 32x32 single icon
|
46
|
+
// 32x48 -> 32x32 and 16x16
|
47
|
+
// 512x512 -> 512x512 single icon
|
48
|
+
// 512x768 -> 512x512, 256x256
|
49
|
+
// 512x640 -> 512x512, 128x128
|
50
|
+
// 512x896 -> 512x512, 256x256 and 128x128
|
51
|
+
// etc..
|
52
|
+
_iconUrl = _options.iconUrl?COMM.Values.values[_options.iconUrl]:false;
|
53
|
+
|
54
|
+
// Construct the application base:
|
55
|
+
_this.base( _priority, _label );
|
56
|
+
|
57
|
+
// Options combined from vars above
|
58
|
+
_this.options = {
|
59
|
+
label: _label,
|
60
|
+
descr: _descr,
|
61
|
+
allowMulti: _allowMulti,
|
62
|
+
sigInput: _sigInput,
|
63
|
+
sigOutput: _sigOutput,
|
64
|
+
icon: { url: _iconUrl, width: null, height: null },
|
65
|
+
pid: this.appId,
|
66
|
+
views: []
|
67
|
+
};
|
68
|
+
|
69
|
+
_this.valueObj = _valueObj;
|
70
|
+
_this.value = _valueObj.value;
|
71
|
+
|
72
|
+
// _this.app = _this;
|
73
|
+
|
74
|
+
//
|
75
|
+
// _this.renderer = COMM.JSONRenderer.extend({
|
76
|
+
//
|
77
|
+
// }).nu( _this.value, _this );
|
78
|
+
},
|
79
|
+
|
80
|
+
die: function(){
|
81
|
+
this.base();
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
})
|
86
|
+
};
|
87
|
+
|
@@ -0,0 +1,234 @@
|
|
1
|
+
#--
|
2
|
+
## Riassence Framework
|
3
|
+
# Copyright 2008 Riassence Inc.
|
4
|
+
# http://riassence.com/
|
5
|
+
#
|
6
|
+
# You should have received a copy of the GNU General Public License along
|
7
|
+
# with this software package. If not, contact licensing@riassence.com
|
8
|
+
##
|
9
|
+
#++
|
10
|
+
|
11
|
+
class Main < Plugin
|
12
|
+
|
13
|
+
def init
|
14
|
+
super
|
15
|
+
@conf = ::RSence.config[:index_html]
|
16
|
+
@bconf = ::RSence.config[:broker_urls]
|
17
|
+
end
|
18
|
+
|
19
|
+
def match( uri, request_type )
|
20
|
+
if request_type == :post and
|
21
|
+
uri == File.join(@bconf[:hello],'goodbye')
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
return false
|
25
|
+
end
|
26
|
+
|
27
|
+
def score; 100; end
|
28
|
+
|
29
|
+
def post( req, res, ses )
|
30
|
+
msg = @plugins.sessions.init_msg( req, res, { :cookies => true } )
|
31
|
+
msg.expire_session()
|
32
|
+
msg.response_done
|
33
|
+
end
|
34
|
+
|
35
|
+
# url_responder gets called whenever the
|
36
|
+
# page location.href changes, enabled virtual uris
|
37
|
+
# to enable back/forward/bookmarking in browsers,
|
38
|
+
# when software is coded to support it.
|
39
|
+
#
|
40
|
+
# Client-side support is included in js/url_responder.js
|
41
|
+
#
|
42
|
+
# Also allows virtual-host -like behavior, if software
|
43
|
+
# is coded to support it.
|
44
|
+
def url_responder(msg,location_href)
|
45
|
+
|
46
|
+
ses = get_ses( msg )
|
47
|
+
|
48
|
+
# Virtual locations:
|
49
|
+
if location_href.data.include?('#')
|
50
|
+
|
51
|
+
# split 'http://localhost:8001/#/some_uri'
|
52
|
+
# -> ['http://localhost:8001/','/some_uri']
|
53
|
+
ses[:url] = location_href.data.split('#')
|
54
|
+
|
55
|
+
virtual_uri = ses[:url][1]
|
56
|
+
|
57
|
+
# built-in support for signing out, deletes the
|
58
|
+
# server-side session and reloads the page
|
59
|
+
if virtual_uri == '/sign_out'
|
60
|
+
resp_addr = @conf[:respond_address]
|
61
|
+
msg.reply( [
|
62
|
+
'COMM.Transporter.stop=true;',
|
63
|
+
"location.href=#{resp_addr.to_json};"
|
64
|
+
].join('') )
|
65
|
+
msg.expire_session()
|
66
|
+
end
|
67
|
+
|
68
|
+
else
|
69
|
+
ses[:url] = [location_href.data,nil]
|
70
|
+
end
|
71
|
+
|
72
|
+
# url_responder always accepts locations
|
73
|
+
return true
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# new session initialization,
|
79
|
+
# called just once per session.
|
80
|
+
def init_ses(msg)
|
81
|
+
super
|
82
|
+
restore_ses( msg )
|
83
|
+
end
|
84
|
+
|
85
|
+
# called once when a session is
|
86
|
+
# restored using the cookie's ses_key
|
87
|
+
def restore_ses(msg)
|
88
|
+
super
|
89
|
+
## Resets session data to defaults
|
90
|
+
ses = get_ses( msg )
|
91
|
+
ses[:boot] = 0
|
92
|
+
ses[:url] = [nil,nil]
|
93
|
+
ses[:delayed_calls] = []
|
94
|
+
ses[:poll_mode] = true
|
95
|
+
end
|
96
|
+
|
97
|
+
# Interface for adding delayed calls
|
98
|
+
def delayed_call( msg, args )
|
99
|
+
get_ses( msg )[:delayed_calls].push( args )
|
100
|
+
end
|
101
|
+
|
102
|
+
# Initializes the client-side COMM.urlResponder and sesWatcher
|
103
|
+
def boot0( msg, ses )
|
104
|
+
|
105
|
+
msg.reply read_js( 'riassence_ns' )
|
106
|
+
|
107
|
+
msg.reply("ELEM.setStyle(0,'background-color','#{::RSence.config[:main_plugin][:bg_color]}');")
|
108
|
+
|
109
|
+
## url_responder is bound in the client-space
|
110
|
+
## to tell the server its status by updating its value
|
111
|
+
location_href_id = ses[:location_href].val_id.to_json
|
112
|
+
msg.reply "COMM.Values.values[#{location_href_id}].bind(COMM.urlResponder);"
|
113
|
+
|
114
|
+
## This enables SesWatcher that changes :client_time every 60 seconds.
|
115
|
+
## It makes the client to poll the server on regular intervals, when polling mode
|
116
|
+
## is disabled.
|
117
|
+
# 5000ms = 5secs
|
118
|
+
|
119
|
+
client_time_id = ses[:client_time].val_id.to_json
|
120
|
+
poll_interval = ::RSence.config[:main_plugin][:server_poll_interval]
|
121
|
+
msg.reply "sesWatcher = COMM.SessionWatcher.nu(#{poll_interval},#{client_time_id});"
|
122
|
+
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
# Calls the init_ui method of each loaded plugin and removes the loading -message
|
127
|
+
def boot1( msg, ses )
|
128
|
+
# Delegates the init_ui method to each plugin to signal bootstrap completion.
|
129
|
+
msg.plugins.delegate( 'init_ui', msg ) unless ses[:dont_init_ui]
|
130
|
+
end
|
131
|
+
|
132
|
+
def dont_init_ui( msg )
|
133
|
+
get_ses( msg )[:dont_init_ui] = true
|
134
|
+
end
|
135
|
+
|
136
|
+
# Flushes commands in the :delayed_calls array
|
137
|
+
def flush_delayed( msg, ses )
|
138
|
+
## Limits the amount of delayed calls to process to 4.
|
139
|
+
## Prevents the client from choking even when the server
|
140
|
+
## load is light.
|
141
|
+
if ses[:delayed_calls].size < 4
|
142
|
+
call_count = ses[:delayed_calls].size
|
143
|
+
else
|
144
|
+
call_count = 4
|
145
|
+
end
|
146
|
+
|
147
|
+
time_start = Time.now.to_f
|
148
|
+
time_taken = 0.0
|
149
|
+
|
150
|
+
## process delayed calls, until:
|
151
|
+
## - over 200ms of cpu time has been spent
|
152
|
+
## - the :delayed_calls -array is empty
|
153
|
+
## - call_count limit is reached
|
154
|
+
until time_taken > 0.2 or ses[:delayed_calls].size == 0 or call_count == 0
|
155
|
+
# gets the next call
|
156
|
+
delayed_call = ses[:delayed_calls].shift
|
157
|
+
if $DEBUG_MODE
|
158
|
+
puts "delayed_call: #{delayed_call.inspect}"
|
159
|
+
end
|
160
|
+
# strings are always javascript, used for segmenting client load
|
161
|
+
if delayed_call.class == String
|
162
|
+
msg.reply delayed_call
|
163
|
+
# arrays are plugin calls
|
164
|
+
elsif delayed_call.class == Array
|
165
|
+
# ['plugin_name', 'method_name'] pairs call the named plugin:method with just msg
|
166
|
+
if delayed_call.size == 2
|
167
|
+
(plugin_name,method_name) = delayed_call
|
168
|
+
msg.run(plugin_name,method_name,msg)
|
169
|
+
# if the array contains more items, they are used as additional method params
|
170
|
+
else
|
171
|
+
(plugin_name,method_name) = delayed_call[0..1]
|
172
|
+
method_params = delayed_call[2..-1]
|
173
|
+
msg.run(plugin_name,method_name,msg,*method_params)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
## calculates time taken
|
177
|
+
time_taken = Time.now.to_f - time_start
|
178
|
+
call_count -= 1
|
179
|
+
end
|
180
|
+
## Sets the client into poll mode, unless the :delayed_calls -array is empty
|
181
|
+
if ses[:boot] > 1
|
182
|
+
if ses[:delayed_calls].empty?
|
183
|
+
end_polling( msg, ses )
|
184
|
+
else
|
185
|
+
start_polling( msg, ses )
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# When nothing is delayed and the second poll has been made (init_ui called),
|
191
|
+
# sets the client to non-polling-mode, having only HValue
|
192
|
+
# changes trigger new requests. SesWatcher makes this happen
|
193
|
+
# regularly.
|
194
|
+
def end_polling( msg, ses )
|
195
|
+
if ses[:poll_mode] == true
|
196
|
+
msg.reply "COMM.Transporter.poll(0);"
|
197
|
+
ses[:poll_mode] = false
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Starts polling.
|
202
|
+
def start_polling( msg, ses )
|
203
|
+
if ses[:poll_mode] == false
|
204
|
+
msg.reply( "COMM.Transporter.poll(#{::RSence.config[:transporter_conf][:client_poll_priority]});" )
|
205
|
+
ses[:poll_mode] = true
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# called on every request of an
|
210
|
+
# active, valid session
|
211
|
+
def idle(msg)
|
212
|
+
|
213
|
+
ses = get_ses( msg )
|
214
|
+
|
215
|
+
if ses[:boot] == 0
|
216
|
+
boot0( msg, ses )
|
217
|
+
elsif ses[:boot] == 1
|
218
|
+
boot1( msg, ses )
|
219
|
+
elsif not ses[:delayed_calls].empty?
|
220
|
+
flush_delayed( msg, ses )
|
221
|
+
elsif ses[:boot] > 1
|
222
|
+
end_polling( msg, ses )
|
223
|
+
end
|
224
|
+
## Increment the counter forever.
|
225
|
+
ses[:boot] += 1
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
## Initialize and register the plugin.
|
231
|
+
main = Main.new.register( :main )
|
232
|
+
|
233
|
+
|
234
|
+
|
@@ -0,0 +1,300 @@
|
|
1
|
+
#--
|
2
|
+
## Riassence Framework
|
3
|
+
# Copyright 2008 Riassence Inc.
|
4
|
+
# http://riassence.com/
|
5
|
+
#
|
6
|
+
# You should have received a copy of the GNU General Public License along
|
7
|
+
# with this software package. If not, contact licensing@riassence.com
|
8
|
+
##
|
9
|
+
#++
|
10
|
+
|
11
|
+
module TicketService
|
12
|
+
module Common
|
13
|
+
|
14
|
+
|
15
|
+
attr_accessor :raw_uris # :nodoc:
|
16
|
+
attr_accessor :imgs # :nodoc:
|
17
|
+
attr_accessor :content_types # :nodoc:
|
18
|
+
|
19
|
+
# Helper method to return the time formatted according to the HTTP RFC
|
20
|
+
def httime(time)
|
21
|
+
return time.gmtime.strftime('%a, %d %b %Y %H:%M:%S %Z')
|
22
|
+
end
|
23
|
+
|
24
|
+
# Disconnects connection to the database.
|
25
|
+
def shutdown # :nodoc:
|
26
|
+
@db.disconnect
|
27
|
+
end
|
28
|
+
|
29
|
+
# Serves files and images by returning an URI. Content is given as second
|
30
|
+
# parameter. Optional third defaults to 'PNG' and defines the format.
|
31
|
+
# Optional fourth parameter is where there are two possibilities :img
|
32
|
+
# and :file, defaults to :img. URI works as an ID for data.
|
33
|
+
def serve( msg, content, format='PNG', type=:img )
|
34
|
+
|
35
|
+
# gets a new, unique identifier
|
36
|
+
ticket_id = @randgen.gen
|
37
|
+
|
38
|
+
# serve image
|
39
|
+
if type == :img
|
40
|
+
|
41
|
+
# makes sure the format is in uppper case
|
42
|
+
format.upcase!
|
43
|
+
|
44
|
+
# checks, that the format is a supported image type
|
45
|
+
unless @content_types.keys.include?( format )
|
46
|
+
puts "ImgServe.serve: invalid format (#{format.inspect})" if $DEBUG_MODE
|
47
|
+
return File.join(::RSence.config[:broker_urls][:i],'invalid.gif')
|
48
|
+
end
|
49
|
+
|
50
|
+
# changes the format to GIF for IE6
|
51
|
+
format = 'GIF' if msg.ie6 and format == 'PNG'
|
52
|
+
|
53
|
+
# stores the image data and meta-data ready to be served
|
54
|
+
storage_hash = @imgs
|
55
|
+
storage_arr = [format,0,content,msg.ses_id]
|
56
|
+
|
57
|
+
# return an uri that will respond to the data
|
58
|
+
uri = File.join(::RSence.config[:broker_urls][:i],"#{ticket_id}.#{format.downcase}")
|
59
|
+
|
60
|
+
# serve file
|
61
|
+
elsif type == :file
|
62
|
+
|
63
|
+
# re-map content_type and filename meta-data from format
|
64
|
+
(content_type, filename) = format
|
65
|
+
|
66
|
+
# content size for the header
|
67
|
+
content_size = content.size.to_s
|
68
|
+
|
69
|
+
storage_hash = @files
|
70
|
+
storage_arr = [content_type,content_size,content,msg.ses_id,filename]
|
71
|
+
|
72
|
+
uri = File.join(::RSence.config[:broker_urls][:f],ticket_id)
|
73
|
+
end
|
74
|
+
|
75
|
+
# makes sure, that the storage array has a sub-array for sessions (to aid session-based cleanup)
|
76
|
+
storage_hash[:ses_ids][msg.ses_id] = [] unless @imgs[:ses_ids].has_key?(msg.ses_id)
|
77
|
+
|
78
|
+
# adds the id to the session-specific storage
|
79
|
+
storage_hash[:ses_ids][msg.ses_id].push( ticket_id )
|
80
|
+
|
81
|
+
storage_hash[:by_id][ticket_id] = storage_arr
|
82
|
+
|
83
|
+
return uri
|
84
|
+
end
|
85
|
+
|
86
|
+
# Alias for +Ticketserve#serve+.
|
87
|
+
alias serve_img serve
|
88
|
+
|
89
|
+
# Flushes disposable storage when the session expires. Session id is given
|
90
|
+
# as a parameter.
|
91
|
+
def expire_ses( ses_id ) # :nodoc:
|
92
|
+
|
93
|
+
# flush images by session id
|
94
|
+
if @imgs[:ses_ids].has_key?(ses_id)
|
95
|
+
|
96
|
+
# goes through the array, until it's empty
|
97
|
+
until @imgs[:ses_ids][ses_id].empty?
|
98
|
+
img_id = @imgs[:ses_ids][ses_id].shift
|
99
|
+
del_img( img_id, ses_id )
|
100
|
+
end
|
101
|
+
|
102
|
+
# finally, removes the session id
|
103
|
+
@imgs[:ses_ids].delete( ses_id )
|
104
|
+
end
|
105
|
+
|
106
|
+
# flush other data by session id
|
107
|
+
if @files[:ses_ids].has_key?(ses_id)
|
108
|
+
|
109
|
+
# goes through the array, until it's empty
|
110
|
+
until @files[:ses_ids][ses_id].empty?
|
111
|
+
file_id = @files[:ses_ids][ses_id].shift
|
112
|
+
del_file( file_id, ses_id )
|
113
|
+
end
|
114
|
+
|
115
|
+
# finally, removes the session id
|
116
|
+
@files[:ses_ids].delete( ses_id )
|
117
|
+
end
|
118
|
+
|
119
|
+
if @upload_slots[:ses_ids].has_key?(ses_id)
|
120
|
+
# goes through the array, until it's empty
|
121
|
+
until @upload_slots[:ses_ids][ses_id].empty?
|
122
|
+
ticket_id = @upload_slots[:ses_ids][ses_id].shift
|
123
|
+
del_uploads( ticket_id, ses_id )
|
124
|
+
end
|
125
|
+
|
126
|
+
# finally, removes the session id
|
127
|
+
@upload_slots[:ses_ids].delete( ses_id )
|
128
|
+
end
|
129
|
+
|
130
|
+
if @blob_objs[:ses_ids].has_key?(ses_id)
|
131
|
+
# goes through the array, until it's empty
|
132
|
+
until @blob_objs[:ses_ids][ses_id].empty?
|
133
|
+
ticket_id = @blob_objs[:ses_ids][ses_id].shift
|
134
|
+
del_blobobj( ticket_id, ses_id )
|
135
|
+
end
|
136
|
+
|
137
|
+
# finally, removes the session id
|
138
|
+
@blob_objs[:ses_ids].delete( ses_id )
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
# Serves data based on get request. Is used automatically by +Broker+.
|
144
|
+
def get_ticket( req, res, type=:img ) # :nodoc:
|
145
|
+
|
146
|
+
is_invalid = true
|
147
|
+
|
148
|
+
if type == :img
|
149
|
+
|
150
|
+
img_id = req.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:i]}(.*)$/)[1]
|
151
|
+
|
152
|
+
if img_id == nil
|
153
|
+
puts "ImgServe.fetch_img: invalid uri#1 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
154
|
+
img_id = 'invalid.gif'
|
155
|
+
end
|
156
|
+
|
157
|
+
img_id = img_id.split('.')[0]
|
158
|
+
|
159
|
+
if img_id == nil
|
160
|
+
puts "ImgServe.fetch_img: invalid uri#2 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
161
|
+
img_id = 'invalid.gif'
|
162
|
+
|
163
|
+
elsif img_id.size != 84
|
164
|
+
puts "ImgServe.fetch_img: invalid img_id (#{img_id.inspect})" if $DEBUG_MODE
|
165
|
+
img_id = 'invalid.gif'
|
166
|
+
end
|
167
|
+
|
168
|
+
if @raw_uris.include?(img_id)
|
169
|
+
(content_type,content_size,content) = @raw_uris[img_id]
|
170
|
+
|
171
|
+
elsif @imgs[:by_id].include?(img_id)
|
172
|
+
|
173
|
+
(format,content_size_zero,img_data,ses_id) = @imgs[:by_id][img_id]
|
174
|
+
|
175
|
+
# renders the Magick::Image object
|
176
|
+
content = img_data.to_blob {
|
177
|
+
self.format = format
|
178
|
+
}
|
179
|
+
|
180
|
+
# content size for the header
|
181
|
+
content_size = content.size.to_s
|
182
|
+
|
183
|
+
# content type for the header
|
184
|
+
content_type = @content_types[format]
|
185
|
+
|
186
|
+
if req.header.has_key?('keep-alive') and req.header['keep-alive'].size > 0
|
187
|
+
keep_alive = req.header['keep-alive'][0].to_i
|
188
|
+
keep_alive = 10 if keep_alive < 10
|
189
|
+
keep_alive = 600 if keep_alive > 600
|
190
|
+
push_keepalive( img_id, keep_alive )
|
191
|
+
expire_keepalives
|
192
|
+
else
|
193
|
+
del_img( img_id, ses_id )
|
194
|
+
end
|
195
|
+
else
|
196
|
+
(content_type,content_size,content) = @raw_uris['invalid.gif']
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
elsif type == :file
|
201
|
+
file_id = req.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:f]}(.*)$/)[1]
|
202
|
+
if file_id == nil
|
203
|
+
puts "fileServe.fetch_file: invalid uri#1 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
204
|
+
file_id = 'invalid.gif'
|
205
|
+
end
|
206
|
+
file_id = file_id.split('.')[0]
|
207
|
+
if file_id == nil
|
208
|
+
puts "fileServe.fetch_file: invalid uri#2 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
209
|
+
file_id = 'invalid.gif'
|
210
|
+
elsif file_id.size != 84
|
211
|
+
puts "fileServe.fetch_file: invalid file_id (#{file_id.inspect})" if $DEBUG_MODE
|
212
|
+
file_id = 'invalid.gif'
|
213
|
+
end
|
214
|
+
if @raw_uris.include?(file_id)
|
215
|
+
(content_type,content_size,content) = @raw_uris[file_id]
|
216
|
+
elsif @files[:by_id].include?(file_id)
|
217
|
+
(content_type,content_size,content,ses_id) = @files[:by_id][file_id]
|
218
|
+
if req.header.has_key?('keep-alive') and req.header['keep-alive'].size > 0
|
219
|
+
keep_alive = req.header['keep-alive'][0].to_i
|
220
|
+
keep_alive = 10 if keep_alive < 10
|
221
|
+
keep_alive = 600 if keep_alive > 600
|
222
|
+
push_keepalive_file( file_id, keep_alive )
|
223
|
+
expire_keepalive_files
|
224
|
+
else
|
225
|
+
del_file( file_id, ses_id )
|
226
|
+
end
|
227
|
+
else
|
228
|
+
(content_type,content_size,content) = @raw_uris['invalid.gif']
|
229
|
+
end
|
230
|
+
|
231
|
+
elsif type == :blobobj
|
232
|
+
blobobj_id = req.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:b]}(.*)$/)[1]
|
233
|
+
if blobobj_id == nil
|
234
|
+
puts "fileServe.fetch_blobobj: invalid uri#1 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
235
|
+
blobobj_id = 'invalid.gif'
|
236
|
+
end
|
237
|
+
if blobobj_id == nil
|
238
|
+
puts "fileServe.fetch_blobobj: invalid uri#2 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
239
|
+
blobobj_id = 'invalid.gif'
|
240
|
+
elsif blobobj_id.size != 84
|
241
|
+
puts "fileServe.fetch_blobobj: invalid blobobj_id (#{blobobj_id.inspect})" if $DEBUG_MODE
|
242
|
+
blobobj_id = 'invalid.gif'
|
243
|
+
end
|
244
|
+
if @raw_uris.include?(blobobj_id)
|
245
|
+
content_type = @raw_uris[blobobj_id].mime
|
246
|
+
content_size = @raw_uris[blobobj_id].size
|
247
|
+
content = @raw_uris[blobobj_id].data
|
248
|
+
elsif @blob_objs[:by_id].include?(blobobj_id)
|
249
|
+
(ses_id, blobobj) = @blob_objs[:by_id][blobobj_id]
|
250
|
+
content_type = blobobj.mime
|
251
|
+
content_size = blobobj.size
|
252
|
+
content = blobobj.data
|
253
|
+
if req.header.has_key?('keep-alive') and req.header['keep-alive'].size > 0
|
254
|
+
keep_alive = req.header['keep-alive'][0].to_i
|
255
|
+
keep_alive = 10 if keep_alive < 10
|
256
|
+
keep_alive = 600 if keep_alive > 600
|
257
|
+
push_keepalive_blobobj( blobobj_id, keep_alive )
|
258
|
+
expire_keepalive_blobobjs
|
259
|
+
else
|
260
|
+
del_blobobj( blobobj_id, ses_id )
|
261
|
+
end
|
262
|
+
else
|
263
|
+
(content_type,content_size,content) = @raw_uris['invalid.gif']
|
264
|
+
end
|
265
|
+
|
266
|
+
elsif type == :rsrc
|
267
|
+
rsrc_id = req.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:d]}(.*)$/)[1]
|
268
|
+
if rsrc_id == nil
|
269
|
+
puts "rsrcServe.fetch_rsrc: invalid uri#1 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
270
|
+
rsrc_id = 'invalid.gif'
|
271
|
+
end
|
272
|
+
rsrc_id = rsrc_id.split('.')[0]
|
273
|
+
if rsrc_id == nil
|
274
|
+
puts "rsrcServe.fetch_rsrc: invalid uri#2 (#{req.unparsed_uri.inspect})" if $DEBUG_MODE
|
275
|
+
rsrc_id = 'invalid.gif'
|
276
|
+
elsif rsrc_id.size != 84
|
277
|
+
puts "rsrcServe.fetch_rsrc: invalid rsrc_id (#{rsrc_id.inspect})" if $DEBUG_MODE
|
278
|
+
rsrc_id = 'invalid.gif'
|
279
|
+
end
|
280
|
+
if @raw_uris.include?(rsrc_id)
|
281
|
+
(content_type,content_size,content) = @raw_uris[rsrc_id]
|
282
|
+
else
|
283
|
+
(content_type,content_size,content) = @raw_uris['invalid.gif']
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
res.status = 200
|
288
|
+
|
289
|
+
res['Content-Type'] = content_type
|
290
|
+
res['Content-Length'] = content_size
|
291
|
+
|
292
|
+
res['Date'] = httime( Time.now )
|
293
|
+
res['Expires'] = httime(Time.now+::RSence.config[:cache_expire])
|
294
|
+
|
295
|
+
res.body = content
|
296
|
+
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
300
|
+
end
|