IOWA 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
data/src/iowa/Client.rb
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
# Iowa::Client encapsulates the methods necessary to make a connection
|
2
|
+
# to an Iowa servlet, receive the response back from the servlet, and to
|
3
|
+
# deliver that response.
|
4
|
+
|
5
|
+
require 'socket'
|
6
|
+
require 'iowa/Request'
|
7
|
+
require 'iowa/Response'
|
8
|
+
require 'iowa/Constants'
|
9
|
+
require 'time'
|
10
|
+
|
11
|
+
module Iowa
|
12
|
+
|
13
|
+
class Client
|
14
|
+
|
15
|
+
EX_HEADERS = {CDate => true, CServer => true, CConnection => true, CContent_Type => true} unless const_defined?(:EX_HEADERS)
|
16
|
+
|
17
|
+
# When an Iowa::Client is created, it takes as its argument a
|
18
|
+
# socket definition. It uses that definition to establish either
|
19
|
+
# a TCPSocket or a UNIXSocket to the servlet.
|
20
|
+
#
|
21
|
+
# The socket defenition can be either in the form of:
|
22
|
+
# hostname:port
|
23
|
+
# or it can be a filesystem path. If one uses the hostname:port
|
24
|
+
# form, then a TCPSocket will be used. Otherwise, a UNIXSocket
|
25
|
+
# will be used.
|
26
|
+
|
27
|
+
def initialize(sp)
|
28
|
+
@start_time = Time.now
|
29
|
+
socket_path = sp.dup
|
30
|
+
socket_path.untaint
|
31
|
+
tcp_pattern = Regexp.new('^([^:]*):(\d+)')
|
32
|
+
tcp_match = tcp_pattern.match(socket_path)
|
33
|
+
if tcp_match
|
34
|
+
# Connect to a TCP socket.
|
35
|
+
socket_host = tcp_match[1]
|
36
|
+
socket_port = tcp_match[2]
|
37
|
+
TCPSocket.do_not_reverse_lookup = true
|
38
|
+
@socket = TCPSocket.new(socket_host,socket_port)
|
39
|
+
else
|
40
|
+
@socket = UNIXSocket.new(socket_path)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# One calls initiate() to send the request off to the servlet.
|
45
|
+
|
46
|
+
def initiate(request=nil)
|
47
|
+
@request = Iowa::Request.new_request(request)
|
48
|
+
m = Marshal.dump(@request)
|
49
|
+
@socket.write(m)
|
50
|
+
@socket.flush
|
51
|
+
@socket.shutdown(1)
|
52
|
+
end
|
53
|
+
|
54
|
+
# This receives the response back from the servlet.
|
55
|
+
|
56
|
+
def receive
|
57
|
+
m = ''
|
58
|
+
while (recv = @socket.recv(8192)) != ""
|
59
|
+
m << recv
|
60
|
+
end
|
61
|
+
@socket.close
|
62
|
+
@socket = nil
|
63
|
+
@response = Marshal.load(m)
|
64
|
+
@response.content_type = Ctext_html unless @response.content_type.to_s != C_empty
|
65
|
+
end
|
66
|
+
|
67
|
+
# Prints/sends the HTTP headers for the response.
|
68
|
+
|
69
|
+
# This path selection for how to output the data is UGLY. Make it better.
|
70
|
+
def printHeaders(ios=nil)
|
71
|
+
@response.calculate_runtime = false unless @response.content_type == Ctext_html
|
72
|
+
@response.content.sub!(/^[\s\r\n]*/m,C_empty)
|
73
|
+
calculate_runtime if @response.calculate_runtime
|
74
|
+
if ENV[CMOD_RUBY]
|
75
|
+
r = Apache.request
|
76
|
+
r.content_type = @response.content_type
|
77
|
+
r.status_line = @response.status_line if @response.status_line
|
78
|
+
r.status = @response.status if @response.status
|
79
|
+
@response.headers_out.each do |key,value|
|
80
|
+
r.headers_out.set(key,value.to_s)
|
81
|
+
end
|
82
|
+
r.headers_out.set(CContent_Length,@response.content.length.to_s)
|
83
|
+
r.send_http_header
|
84
|
+
elsif ::Object.const_defined?(:Mongrel) and !::Object.const_defined?(:EventMachine)
|
85
|
+
ios.status = @response.status
|
86
|
+
# @response.headers_out[CDate] ||= Time.now.httpdate
|
87
|
+
@response.headers_out[CExpires] ||= Time.now.httpdate
|
88
|
+
ioshead = ios.header
|
89
|
+
ioshead.out << "#{CContent_Type}: #{@response.content_type}\r\n"
|
90
|
+
# @response.headers_out[CContent_Length] = @response.content.length unless @response.headers_out[CContent_Length]
|
91
|
+
@response.headers_out.each do |key, value|
|
92
|
+
ioshead.out << "#{key}: #{value}\r\n"
|
93
|
+
end
|
94
|
+
elsif ios
|
95
|
+
outbuf = ''
|
96
|
+
@response.headers_out[CDate] ||= Time.now.httpdate
|
97
|
+
@response.headers_out[CExpires] ||= @response.headers_out[CDate]
|
98
|
+
outbuf << "Date: #{@response.headers_out[CDate]}\r\n"
|
99
|
+
|
100
|
+
@response.headers_out[CContent_Length] = @response.content.length unless @response.headers_out[CContent_Length]
|
101
|
+
|
102
|
+
@response.headers_out.each do |key, value|
|
103
|
+
next if EX_HEADERS.has_key? key
|
104
|
+
outbuf << "#{key}: #{value}\r\n"
|
105
|
+
end
|
106
|
+
outbuf << "Content-Type: #{@response.content_type}\r\n\r\n"
|
107
|
+
ios.print outbuf
|
108
|
+
else
|
109
|
+
@response.headers_out[CDate] ||= Time.now.httpdate
|
110
|
+
@response.headers_out[CExpires] ||= @response.headers_out[CDate]
|
111
|
+
# @response.headers_out[CServer] ||= ENV['SERVER_SOFTWARE']
|
112
|
+
puts "Date: #{@response.headers_out['Date']}"
|
113
|
+
puts "Content-Type: #{@response.content_type}"
|
114
|
+
if @response.headers_out['Content-Length']
|
115
|
+
EX_HEADERS['Content-Length'] = true
|
116
|
+
else
|
117
|
+
puts "Content-Length: #{@response.content.length}"
|
118
|
+
end
|
119
|
+
@response.headers_out.each do |key, value|
|
120
|
+
next if EX_HEADERS.has_key? key
|
121
|
+
puts "#{key}: #{value}"
|
122
|
+
end
|
123
|
+
puts ""
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deliver the content of the request.
|
128
|
+
|
129
|
+
def printBody(ios=nil)
|
130
|
+
unless @request.request_method == CHEAD
|
131
|
+
if ios
|
132
|
+
if ::Object.const_defined?(:Mongrel) and !::Object.const_defined?(:EventMachine)
|
133
|
+
ios.body << @response.content
|
134
|
+
else
|
135
|
+
ios.print @response.content
|
136
|
+
end
|
137
|
+
else
|
138
|
+
puts @response.content
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def clearOld
|
144
|
+
@socket = nil
|
145
|
+
@request = nil
|
146
|
+
@response = nil
|
147
|
+
end
|
148
|
+
|
149
|
+
# Deliver both the header and the content of the request, then clear
|
150
|
+
# the client.
|
151
|
+
|
152
|
+
def print(ios = nil)
|
153
|
+
printHeaders(ios)
|
154
|
+
printBody(ios)
|
155
|
+
clearOld
|
156
|
+
end
|
157
|
+
|
158
|
+
def calculate_runtime
|
159
|
+
@runtime = Time.now - @start_time
|
160
|
+
@response.content << "\n<!-- #{@runtime} -->\n"
|
161
|
+
end
|
162
|
+
|
163
|
+
def handle_request(args = {:request => nil, :ios => nil})
|
164
|
+
initiate(args[:request])
|
165
|
+
receive
|
166
|
+
print(args[:ios])
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# An InlineClient doesn't do any socket communications. It just handles printing
|
171
|
+
# a response.
|
172
|
+
class InlineClient < Client
|
173
|
+
def initialize(request,response)
|
174
|
+
@request = request
|
175
|
+
@response = response
|
176
|
+
@start_time = Time.now
|
177
|
+
end
|
178
|
+
|
179
|
+
def reset(request,response)
|
180
|
+
@request = request
|
181
|
+
@response = response
|
182
|
+
@start_time = Time.now
|
183
|
+
end
|
184
|
+
|
185
|
+
def initiate; end
|
186
|
+
def receive; end
|
187
|
+
|
188
|
+
def handle_request(args = {:ios => nil})
|
189
|
+
print(args[:ios])
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,405 @@
|
|
1
|
+
require 'iowa/JSON-lexer'
|
2
|
+
require 'iowa/caches/SimpleLRUCache'
|
3
|
+
require 'iowa/Monkey'
|
4
|
+
module Iowa
|
5
|
+
|
6
|
+
# Provides high level functionality for all component subclasses.
|
7
|
+
# Each "page" in an Iowa app is a Component subclass.
|
8
|
+
|
9
|
+
class Component < Element
|
10
|
+
include Iowa::Caches::SimpleLRUCache::Item
|
11
|
+
|
12
|
+
@max_cache_entries = nil
|
13
|
+
def self.max_cache_entries; @max_cache_entries; end
|
14
|
+
def self.MaxCacheEntries(val=nil)
|
15
|
+
if val
|
16
|
+
@max_cache_entries = val
|
17
|
+
else
|
18
|
+
@max_cache_entries
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
@@serializeCompiledTemplate = true
|
23
|
+
|
24
|
+
def Component.serializeCompiledTemplate
|
25
|
+
@@serializeCompiledTemplate
|
26
|
+
end
|
27
|
+
|
28
|
+
def Component.serializeCompiledTemplate=(val)
|
29
|
+
@@serializeCompiledTemplate = val
|
30
|
+
end
|
31
|
+
|
32
|
+
def Component.bindings
|
33
|
+
{}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns the template for the component.
|
37
|
+
|
38
|
+
def Component.template
|
39
|
+
Iowa.app.templateForComponent(self.name)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Finds and returns the named component. Other methods calling this
|
43
|
+
# one with different values for session and prevPage could induce some
|
44
|
+
# interesting (or bizarre) behaviors. See pageNamed(name) below for
|
45
|
+
# the standard invocation.
|
46
|
+
|
47
|
+
def Component.pageNamed(name, session, prevPage=nil,import_attempted=nil,raise_exception=true)
|
48
|
+
Iowa.app.reloadModified(name,true)
|
49
|
+
klass = ElementClasses[name.to_s.downcase]
|
50
|
+
if(klass && klass.ancestors.include?(Component))
|
51
|
+
page = klass.new(Cpage, {}, {}, prevPage)
|
52
|
+
page.prevPage = prevPage
|
53
|
+
page.session = session
|
54
|
+
page
|
55
|
+
else
|
56
|
+
if !import_attempted
|
57
|
+
import_attempted = true
|
58
|
+
Iowa::Log.info("Attempting to import #{name} as a #{self.name}")
|
59
|
+
Iowa.app.import(name,self.name)
|
60
|
+
pageNamed(name.capitalize,session,prevPage,true,raise_exception)
|
61
|
+
elsif raise_exception
|
62
|
+
session.context.response.status = 404
|
63
|
+
raise "#{name}: No component found."
|
64
|
+
else
|
65
|
+
nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Provides a method to define component attributes which another
|
71
|
+
# component can bind to.
|
72
|
+
|
73
|
+
def Component.attr_binding(*symbols)
|
74
|
+
symbols.each do |symbol|
|
75
|
+
class_eval %{
|
76
|
+
def #{symbol}
|
77
|
+
if @bindings.has_key?('#{symbol}')
|
78
|
+
@bindings['#{symbol}'].get(@parent)
|
79
|
+
else
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
def #{symbol}=(val)
|
84
|
+
if @bindings.has_key?('#{symbol}')
|
85
|
+
@bindings['#{symbol}'].set(@parent, val)
|
86
|
+
else
|
87
|
+
@bindings['#{symbol}'] = LiteralAssociation.new(val)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
}
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# If fingerprint is overridden to return a non-nil value, that value will
|
95
|
+
# be used as a cache key for the rendered content. If a future request
|
96
|
+
# returns the same fingerprint, the cached content will be returned.
|
97
|
+
# IOWA will not permit any session-specific renderings to be cached.
|
98
|
+
def fingerprint
|
99
|
+
nil
|
100
|
+
end
|
101
|
+
|
102
|
+
# Standard invocation of Component.pageNamed. Returns the component
|
103
|
+
# corresponding the the given name.
|
104
|
+
|
105
|
+
def page_named(name, *args)
|
106
|
+
my_name = self.class.name.gsub(/Iowa::Application::ContentClasses::/,C_empty).split(ClassSeparator)
|
107
|
+
my_name.pop
|
108
|
+
my_name << name
|
109
|
+
#relative_name = "#{my_name.join('::')}::#{name}"
|
110
|
+
relative_name = my_name.join(ClassSeparator)
|
111
|
+
|
112
|
+
iter = 0
|
113
|
+
component = nil
|
114
|
+
loop do
|
115
|
+
begin
|
116
|
+
if ElementClasses.has_key?(relative_name.downcase)
|
117
|
+
break component = Component.pageNamed(relative_name, @session, self)
|
118
|
+
else
|
119
|
+
if iter < 1
|
120
|
+
iter += 1
|
121
|
+
Iowa.app.reloadModified(relative_name,true)
|
122
|
+
raise "retry"
|
123
|
+
else
|
124
|
+
break component = Component.pageNamed(name, @session, self)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
rescue
|
128
|
+
retry
|
129
|
+
end
|
130
|
+
end
|
131
|
+
args.each do |arg|
|
132
|
+
if arg.respond_to?(:each)
|
133
|
+
arg.each {|k,v| component.__send__(k,v)}
|
134
|
+
else
|
135
|
+
component.__send__(arg)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
component
|
140
|
+
end
|
141
|
+
alias :pageNamed :page_named
|
142
|
+
alias :componentNamed :page_named
|
143
|
+
alias :component_named :page_named
|
144
|
+
|
145
|
+
# Define a method called "meth" to show the page named "page".
|
146
|
+
def self.proceed(meth, page)
|
147
|
+
module_eval(<<-EVAL)
|
148
|
+
def #{meth}
|
149
|
+
yield page_named('#{page}')
|
150
|
+
end
|
151
|
+
EVAL
|
152
|
+
end
|
153
|
+
|
154
|
+
# Define a method called "meth" to show the page named "page"
|
155
|
+
# after executing the "block" in the destination page's context.
|
156
|
+
def self.proceed_with(meth, page, &block)
|
157
|
+
define_method("__#{meth}__primer__".intern, block)
|
158
|
+
module_eval(<<-EVAL)
|
159
|
+
def #{meth}
|
160
|
+
p = page_named('#{page}')
|
161
|
+
__#{meth}__primer__(p)
|
162
|
+
yield p
|
163
|
+
end
|
164
|
+
EVAL
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
# Default to individual components allowing themselves to be docroot cached.
|
169
|
+
# To change this, in the component, one can use the class method:
|
170
|
+
#
|
171
|
+
# disallow_docroot_caching
|
172
|
+
#
|
173
|
+
# or the object method:
|
174
|
+
#
|
175
|
+
# self.allow_docroot_caching = false
|
176
|
+
|
177
|
+
attr_accessor :session, :prevPage, :subcomponents, :parent, :creation_time
|
178
|
+
|
179
|
+
# Handle the initial tasks that establish the state of the new object.
|
180
|
+
|
181
|
+
def initialize(name, bindings, attributes, parent)
|
182
|
+
self.cacheable = true unless @cacheable == false
|
183
|
+
self.replaceable = false unless replaceable?
|
184
|
+
self.fragment = false unless fragment?
|
185
|
+
@creation_time = Time.now
|
186
|
+
@parent = parent
|
187
|
+
@session = parent ? parent.session : nil
|
188
|
+
|
189
|
+
self.allow_docroot_caching = false if allow_docroot_caching?.nil?
|
190
|
+
|
191
|
+
@subcomponents = {}
|
192
|
+
super(name, bindings, attributes)
|
193
|
+
|
194
|
+
awake()
|
195
|
+
end
|
196
|
+
|
197
|
+
def context
|
198
|
+
@session.context
|
199
|
+
end
|
200
|
+
|
201
|
+
def url_for_id
|
202
|
+
@session.context.url_for_id
|
203
|
+
end
|
204
|
+
|
205
|
+
def cacheable
|
206
|
+
@cacheable
|
207
|
+
end
|
208
|
+
|
209
|
+
def cacheable?
|
210
|
+
@session.context[:request_cacheable] || cacheable
|
211
|
+
end
|
212
|
+
|
213
|
+
def cacheable=(val)
|
214
|
+
@cacheable = val ? true : false
|
215
|
+
end
|
216
|
+
|
217
|
+
def replaceable
|
218
|
+
@replaceable
|
219
|
+
end
|
220
|
+
|
221
|
+
def replaceable?
|
222
|
+
replaceable
|
223
|
+
end
|
224
|
+
|
225
|
+
def replaceable=(val)
|
226
|
+
@replaceable = val ? true : false
|
227
|
+
end
|
228
|
+
|
229
|
+
def fragment
|
230
|
+
@fragment
|
231
|
+
end
|
232
|
+
|
233
|
+
def fragment=(val)
|
234
|
+
@fragment = val ? true : false
|
235
|
+
end
|
236
|
+
|
237
|
+
def fragment?
|
238
|
+
fragment
|
239
|
+
end
|
240
|
+
|
241
|
+
def self.allow_docroot_caching
|
242
|
+
@allow_docroot_caching = true
|
243
|
+
end
|
244
|
+
|
245
|
+
def self.disallow_docroot_caching
|
246
|
+
@allow_docroot_caching = false
|
247
|
+
end
|
248
|
+
|
249
|
+
def self.allow_docroot_caching?
|
250
|
+
@allow_docroot_caching
|
251
|
+
end
|
252
|
+
|
253
|
+
def allow_docroot_caching?
|
254
|
+
self.class.allow_docroot_caching?
|
255
|
+
end
|
256
|
+
|
257
|
+
def allow_docroot_caching=(val)
|
258
|
+
klass = self.class
|
259
|
+
val ? klass.allow_docroot_caching : klass.disallow_docroot_caching
|
260
|
+
end
|
261
|
+
|
262
|
+
# Stub, intended to be overridden in the subclasses, to define behavior
|
263
|
+
# that occurs only once, when the object is first created.
|
264
|
+
|
265
|
+
def awake
|
266
|
+
end
|
267
|
+
|
268
|
+
# Stub, intended to be overridden in the subclasses, to define behavior
|
269
|
+
# that occurs when backtracking.
|
270
|
+
|
271
|
+
def handle_backtrack
|
272
|
+
end
|
273
|
+
alias :handleBacktrack :handle_backtrack
|
274
|
+
|
275
|
+
# Stub, intended to be overridden in the subclasses, to define behavior
|
276
|
+
# that occurs each time the component is displayed.
|
277
|
+
|
278
|
+
def setup
|
279
|
+
end
|
280
|
+
|
281
|
+
# Takes the result of some method, plus the id of the originating
|
282
|
+
# JSON-RP call, and creates the JSON-RPC reponse
|
283
|
+
def format_repsonse( result, error, id )
|
284
|
+
quote = '"'
|
285
|
+
'{ "result" : ' + result.to_json +
|
286
|
+
', "error":"' + error.to_s +
|
287
|
+
'", "id": ' + quote + id.to_s + quote + ' }'
|
288
|
+
end
|
289
|
+
|
290
|
+
def json_methods
|
291
|
+
[:list_methods]
|
292
|
+
end
|
293
|
+
|
294
|
+
def list_methods
|
295
|
+
json_methods
|
296
|
+
end
|
297
|
+
|
298
|
+
# Sets up a standard method that will return a URL for handling JSON-RPC
|
299
|
+
# requests.
|
300
|
+
def json
|
301
|
+
session.resource_url do
|
302
|
+
# Get the request info
|
303
|
+
content = @session.context.response.body
|
304
|
+
|
305
|
+
# Create new JSON lexer
|
306
|
+
jsonobj = {}.from_json(JSON::Lexer.new(content))
|
307
|
+
# Decode request
|
308
|
+
r = nil
|
309
|
+
error = nil
|
310
|
+
# Verify that it is for an allowed method
|
311
|
+
# Call Method
|
312
|
+
params = jsonobj[Cparams] ? jsonobj[Cparams] : []
|
313
|
+
|
314
|
+
begin
|
315
|
+
if json_methods.include?(jsonobj[Cmethod].to_sym)
|
316
|
+
r = params.size < 1 ?
|
317
|
+
self.__send__(jsonobj[Cmethod]) :
|
318
|
+
self.__send__(jsonobj[Cmethod], *jsonobj[Cparams])
|
319
|
+
end
|
320
|
+
rescue Exception => e
|
321
|
+
error = e.to_s
|
322
|
+
end
|
323
|
+
# Return Resource
|
324
|
+
Iowa::Resource.new(format_repsonse( r, error, jsonobj[Cid] || Cdefault ),Ctext_javascript)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
# Returns the Application object.
|
329
|
+
|
330
|
+
def application
|
331
|
+
Iowa.app
|
332
|
+
end
|
333
|
+
|
334
|
+
# Trigger an action on the component.
|
335
|
+
|
336
|
+
def invokeAction(action, args, &b)
|
337
|
+
arty = method(action).arity
|
338
|
+
if args.length == arty or arty == -1
|
339
|
+
__send__(action, *args, &b)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
def handleResponse(context,return_response = false)
|
344
|
+
@template = self.class.template
|
345
|
+
setup
|
346
|
+
if return_response
|
347
|
+
old_response = context.response
|
348
|
+
end
|
349
|
+
handleRequestOrResponse(:handleResponse, context)
|
350
|
+
if return_response
|
351
|
+
context.response = old_response
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
def handleRequest(context)
|
356
|
+
handleRequestOrResponse(:handleRequest, context)
|
357
|
+
end
|
358
|
+
|
359
|
+
def handleRequestOrResponse(method, context)
|
360
|
+
Iowa.app.reloadModified(self.class.name,true)
|
361
|
+
|
362
|
+
context.pushRoot self
|
363
|
+
@template.__send__(method, context)
|
364
|
+
context.popRoot
|
365
|
+
end
|
366
|
+
|
367
|
+
def getBinding(binding)
|
368
|
+
@bindings[binding].get(@parent)
|
369
|
+
end
|
370
|
+
|
371
|
+
def setBinding(binding, value)
|
372
|
+
@bindings[binding].set(@parent, value)
|
373
|
+
end
|
374
|
+
|
375
|
+
def dup
|
376
|
+
copy = super
|
377
|
+
copy.subcomponents = {}
|
378
|
+
copy.creation_time = Time.now
|
379
|
+
@subcomponents.each do |name, child|
|
380
|
+
newChild = child.dup
|
381
|
+
newChild.parent = copy
|
382
|
+
copy.subcomponents[name] = newChild
|
383
|
+
end
|
384
|
+
copy
|
385
|
+
end
|
386
|
+
|
387
|
+
def back; yield @prevPage if @prevPage; end
|
388
|
+
|
389
|
+
def reload; end
|
390
|
+
|
391
|
+
# This is a default method_missing handler that will keep Ruby from going
|
392
|
+
# down the path of a very, very long backtrace generation in the event
|
393
|
+
# of this kind of error (which is an easy error to make).
|
394
|
+
|
395
|
+
def method_missing(*args)
|
396
|
+
raise "Method missing: #{args.inspect}"
|
397
|
+
end
|
398
|
+
|
399
|
+
def method_missing(*args)
|
400
|
+
Monkey.new("@#{args[0]}")
|
401
|
+
end
|
402
|
+
|
403
|
+
end
|
404
|
+
|
405
|
+
end
|