From 30aca350b9535ab1090afddedf732fe92fe6515c Mon Sep 17 00:00:00 2001 From: interp Date: Thu, 3 Oct 2002 00:15:44 +0000 Subject: [PATCH] feature servlet-data added --- scheme/httpd/surflets/packages.scm | 8 +++++++- scheme/httpd/surflets/surflet-handler.scm | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/scheme/httpd/surflets/packages.scm b/scheme/httpd/surflets/packages.scm index a2b3641..daca407 100644 --- a/scheme/httpd/surflets/packages.scm +++ b/scheme/httpd/surflets/packages.scm @@ -72,6 +72,8 @@ (export send/suspend ;send and suspend send/finish ;send and finish send ;just send (no finish, no suspend) + set-servlet-data! + get-servlet-data )) (define-interface servlet-handler/admin-interface @@ -162,7 +164,10 @@ make-address returned-via? - make-callback)) + make-callback + + set-servlet-data! + get-servlet-data)) (define-structure servlets servlets-interface (open servlet-handler/servlet @@ -172,6 +177,7 @@ parse-html-forms sxml-to-html ; SXML->HTML srfi-1 ; FILTER + (subset srfi-13 (string-index)) sxml-tree-trans url httpd-request diff --git a/scheme/httpd/surflets/surflet-handler.scm b/scheme/httpd/surflets/surflet-handler.scm index 374a6f0..7c4efcd 100644 --- a/scheme/httpd/surflets/surflet-handler.scm +++ b/scheme/httpd/surflets/surflet-handler.scm @@ -8,13 +8,15 @@ (define-record-type instance :instance (make-instance servlet-name memo continuation-table continuation-table-lock - continuation-counter) + continuation-counter + servlet-data) instance? (servlet-name instance-servlet-name) (memo instance-memo set-instance-memo!) (continuation-table instance-continuation-table) (continuation-table-lock instance-continuation-table-lock) - (continuation-counter instance-continuation-counter)) + (continuation-counter instance-continuation-counter) + (servlet-data instance-servlet-data set-instance-servlet-data!)) (define-record memo (message 'kill) ;kill, killed, adjust-timeout @@ -350,7 +352,20 @@ (table-set! continuation-table continuation-id #f)) (release-lock continuation-table-lock))))) +(define (set-servlet-data! new-data) + (let ((instance (instance-lookup (session-instance-id)))) + (if instance + (begin + (set-instance-servlet-data! instance new-data) + #t) + #f))) +(define (get-servlet-data) + (let ((instance (instance-lookup (session-instance-id)))) + (if instance + (instance-servlet-data instance) + (error "Instance no longer alive.")))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ID generation ;; locking must be done by caller