Use preserved-thread-fluids for the options. With this, the stay the
same between to calls to the servlet-handler.
This commit is contained in:
parent
9fb5c80f65
commit
a920462ba1
|
@ -41,14 +41,15 @@
|
|||
(cache-servlets? #t)
|
||||
(instance-lifetime 600)) ; in seconds
|
||||
|
||||
(define *options* (make-thread-cell #f))
|
||||
;(define *options-lock* (make-lock)) ; currently unused
|
||||
(define *options* (make-preserved-thread-fluid #f))
|
||||
;; preserved thread fluid because between different calls to
|
||||
;; servlet-handler the options shall remain the same.
|
||||
|
||||
(define (make-fluid-selector selector)
|
||||
(lambda () (selector (thread-cell-ref *options*))))
|
||||
(lambda () (selector (thread-fluid *options*))))
|
||||
(define (make-fluid-setter setter)
|
||||
(lambda (value)
|
||||
(setter (thread-cell-ref *options*) value)))
|
||||
(setter (thread-fluid *options*) value)))
|
||||
(define options-servlet-path (make-fluid-selector options:servlet-path))
|
||||
(define options-servlet-prefix (make-fluid-selector options:servlet-prefix))
|
||||
(define options-cache-servlets? (make-fluid-selector options:cache-servlets?))
|
||||
|
@ -69,8 +70,8 @@
|
|||
|
||||
;; servlet-prefix gives virtual prefixed path to servlets
|
||||
(define (servlet-handler servlet-path servlet-prefix)
|
||||
(set-thread-fluid! *options* (make-options servlet-path servlet-prefix))
|
||||
(lambda (path req)
|
||||
(thread-cell-set! *options* (make-options servlet-path servlet-prefix))
|
||||
(if (pair? path) ; need at least one element
|
||||
(let ((request-method (request:method req))
|
||||
(path-string (uri-path-list->path path)))
|
||||
|
|
Loading…
Reference in New Issue