You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2018/01/01 11:53:27 UTC
svn commit: r1819760 - in /tcl/rivet/trunk/doc:
examples-sgml/myapp_request_handler.tcl examples-sgml/myrivetapp.tcl
examples/myapp_request_handler.tcl examples/myrivetapp.tcl
Author: mxmanghi
Date: Mon Jan 1 11:53:27 2018
New Revision: 1819760
URL: http://svn.apache.org/viewvc?rev=1819760&view=rev
Log:
add new examples
Added:
tcl/rivet/trunk/doc/examples-sgml/myapp_request_handler.tcl
tcl/rivet/trunk/doc/examples-sgml/myrivetapp.tcl
tcl/rivet/trunk/doc/examples/myapp_request_handler.tcl
tcl/rivet/trunk/doc/examples/myrivetapp.tcl
Added: tcl/rivet/trunk/doc/examples-sgml/myapp_request_handler.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/examples-sgml/myapp_request_handler.tcl?rev=1819760&view=auto
==============================================================================
--- tcl/rivet/trunk/doc/examples-sgml/myapp_request_handler.tcl (added)
+++ tcl/rivet/trunk/doc/examples-sgml/myapp_request_handler.tcl Mon Jan 1 11:53:27 2018
@@ -0,0 +1,47 @@
+# -- myapp_request_handler.tcl
+#
+# This script will be read by mod_rivet at the thread initialization
+# stage and its content stored in a Tcl_Obj object. This object will
+# be evaluated calling Tcl_EvalObjExe
+#
+
+::try {
+
+ $::theApplication request_processing [::rivet::var_qs all]
+
+} trap {RIVET ABORTPAGE} {err opts} {
+
+ set abort_code [::rivet::abort_code]
+
+ switch $abort_code {
+ code1 {
+ # handling abort_page with code1
+ ....
+ }
+ code2 {
+ # handling abort_page with code2
+ ....
+ }
+ # ...
+ default {
+ # default abort handler
+ }
+ }
+
+} trap {RIVET THREAD_EXIT} {err opts} {
+
+ # myApplication sudden exit handler
+ ...
+
+} on error {err opts} {
+
+ # myApplication error handler
+ ...
+
+} finally {
+
+ # request processing final elaboration
+
+}
+
+# -- myapp_request_handler.tcl
Added: tcl/rivet/trunk/doc/examples-sgml/myrivetapp.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/examples-sgml/myrivetapp.tcl?rev=1819760&view=auto
==============================================================================
--- tcl/rivet/trunk/doc/examples-sgml/myrivetapp.tcl (added)
+++ tcl/rivet/trunk/doc/examples-sgml/myrivetapp.tcl Mon Jan 1 11:53:27 2018
@@ -0,0 +1,37 @@
+## myrivetapp.tcl --
+#
+# Application class definition and instance creation
+#
+
+package require Itcl
+
+::itcl::class MyRivetApp {
+
+ private variable application_name
+
+ public method init {}
+ public method request_processing {urlencoded_args}
+
+}
+
+::itcl::body MyRivetApp::init {app_name}{
+
+ # any initialization steps must go here
+ # ....
+
+ set application_name $app_name
+
+}
+
+::itcl::body MyRivetApp::request_processing {urlencoded_args} {
+
+ # the whole application code will run from this method
+ ...
+
+}
+
+set ::theApplication [MyRivetApp #auto]
+
+$::theApplication init [dict get [::rivet::inspect server] hostname]
+
+# -- myrivetapp.tcl
Added: tcl/rivet/trunk/doc/examples/myapp_request_handler.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/examples/myapp_request_handler.tcl?rev=1819760&view=auto
==============================================================================
--- tcl/rivet/trunk/doc/examples/myapp_request_handler.tcl (added)
+++ tcl/rivet/trunk/doc/examples/myapp_request_handler.tcl Mon Jan 1 11:53:27 2018
@@ -0,0 +1,47 @@
+# -- myapp_request_handler.tcl
+#
+# This script will be read by mod_rivet at the thread initialization
+# stage and its content stored in a Tcl_Obj object. This object will
+# be evaluated calling Tcl_EvalObjExe
+#
+
+::try {
+
+ ::theApplication request_processing [::rivet::var_qs all]
+
+} trap {RIVET ABORTPAGE} {err opts} {
+
+ set abort_code [::rivet::abort_code]
+
+ switch $abort_code {
+ code1 {
+ # handling abort_page with code1
+ ....
+ }
+ code2 {
+ # handling abort_page with code2
+ ....
+ }
+ # ...
+ default {
+ # default abort handler
+ }
+ }
+
+} trap {RIVET THREAD_EXIT} {err opts} {
+
+ # myApplication sudden exit handler
+ ...
+
+} on error {err opts} {
+
+ # myApplication error handler
+ ...
+
+} finally {
+
+ # request processing final elaboration
+
+}
+
+# -- myapp_request_handler.tcl
Added: tcl/rivet/trunk/doc/examples/myrivetapp.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/examples/myrivetapp.tcl?rev=1819760&view=auto
==============================================================================
--- tcl/rivet/trunk/doc/examples/myrivetapp.tcl (added)
+++ tcl/rivet/trunk/doc/examples/myrivetapp.tcl Mon Jan 1 11:53:27 2018
@@ -0,0 +1,39 @@
+## myrivetapp.tcl --
+#
+# Application class definition and instance creation
+#
+
+package require Itcl
+
+::itcl::class MyRivetApp {
+
+ private variable application_name
+
+ public method init {}
+ public method request_processing {urlencoded_args}
+ public method abort_handler {abort_code}
+ public method error_handler {error_info}
+
+}
+
+::itcl::body MyRivetApp::init {app_name}{
+
+ # any initialization steps must go here
+ # ....
+
+ set application_name $app_name
+
+}
+
+::itcl::body MyRivetApp::request_processing {urlencoded_args} {
+
+ # the whole application code will run from this method
+ ...
+
+}
+
+MyRivetApp ::theApplication
+
+::theApplication init [dict get [::rivet::inspect server] hostname]
+
+# -- myrivetapp.tcl
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org