Improving servlet extent error message

svn: r859
This commit is contained in:
Jay McCarthy 2005-09-15 22:00:13 +00:00
parent 8a35993125
commit 442286672b
4 changed files with 24 additions and 30 deletions

View File

@ -6,20 +6,13 @@
(default-indices "index.html" "index.htm") (default-indices "index.html" "index.htm")
(log-format parenthesized-default) (log-format parenthesized-default)
(messages (messages
(servlet-message (servlet-message "servlet-error.html")
"servlet-error.html") (authentication-message "forbidden.html")
(authentication-message (servlets-refreshed "servlet-refresh.html")
"forbidden.html") (passwords-refreshed "passwords-refresh.html")
(servlets-refreshed (file-not-found-message "not-found.html")
"servlet-refresh.html") (protocol-message "protocol-error.html")
(passwords-refreshed (collect-garbage "collect-garbage.html"))
"passwords-refresh.html")
(file-not-found-message
"not-found.html")
(protocol-message
"protocol-error.html")
(collect-garbage
"collect-garbage.html"))
(timeouts (timeouts
(default-servlet-timeout 30) (default-servlet-timeout 30)
(password-connection-timeout 300) (password-connection-timeout 300)
@ -28,14 +21,9 @@
(file-base-connection-timeout 30)) (file-base-connection-timeout 30))
(paths (paths
(configuration-root "conf") (configuration-root "conf")
(host-root (host-root "default-web-root")
"default-web-root") (log-file-path "log")
(log-file-path (file-root "htdocs")
"log") (servlet-root ".")
(file-root (password-authentication "passwords"))))
"htdocs")
(servlet-root
".")
(password-authentication
"passwords"))))
(virtual-host-table)) (virtual-host-table))

View File

@ -203,6 +203,8 @@
(define (invoke-servlet-continuation conn req k-ref host-info) (define (invoke-servlet-continuation conn req k-ref host-info)
(let-values ([(uk-instance uk-id uk-salt) (apply values k-ref)]) (let-values ([(uk-instance uk-id uk-salt) (apply values k-ref)])
(let* ([uri (request-uri req)] (let* ([uri (request-uri req)]
[default-servlet-instance-expiration-handler
(make-default-servlet-instance-expiration-handler host-info)]
[default-servlet-continuation-expiration-handler [default-servlet-continuation-expiration-handler
(make-default-servlet-continuation-expiration-handler host-info)] (make-default-servlet-continuation-expiration-handler host-info)]
[real-servlet-path (url-path->path [real-servlet-path (url-path->path
@ -219,7 +221,13 @@
(request-method req)))] (request-method req)))]
[exn:servlet:continuation? [exn:servlet:continuation?
(lambda (the-exn) (lambda (the-exn)
((exn:servlet:continuation-expiration-handler the-exn) req))]) ((exn:servlet:continuation-expiration-handler the-exn) req))]
[exn:servlet:no-current-instance?
(lambda (the-exn)
(output-response/method
conn
((default-servlet-instance-expiration-handler) req)
(request-method req)))])
(let* ([inst (let* ([inst
(hash-table-get config:instances uk-instance (hash-table-get config:instances uk-instance
(lambda () (lambda ()

View File

@ -4,7 +4,7 @@
(lib "list.ss") (lib "list.ss")
"timer.ss") "timer.ss")
(provide (struct exn:servlet:instance ()) (provide (struct exn:servlet:instance ())
(struct exn:servlet:current-instance ()) (struct exn:servlet:no-current-instance ())
(struct exn:servlet:continuation (expiration-handler)) (struct exn:servlet:continuation (expiration-handler))
(struct servlet (handler namespace instance-expiration-handler)) (struct servlet (handler namespace instance-expiration-handler))
(struct execution-context (connection request suspend)) (struct execution-context (connection request suspend))
@ -48,7 +48,7 @@
;; not found in the continuatin table ;; not found in the continuatin table
(define-struct (exn:servlet:continuation exn) (expiration-handler)) (define-struct (exn:servlet:continuation exn) (expiration-handler))
;; not in dynamic extent of servlet ;; not in dynamic extent of servlet
(define-struct (exn:servlet:current-instance exn) ()) (define-struct (exn:servlet:no-current-instance exn) ())
(define-values (make-k-table reset-k-table get-k-id!) (define-values (make-k-table reset-k-table get-k-id!)
(let ([id-slot 'next-k-id]) (let ([id-slot 'next-k-id])

View File

@ -36,9 +36,7 @@
(define (get-current-servlet-instance) (define (get-current-servlet-instance)
(let ([inst (thread-cell-ref current-servlet-instance)]) (let ([inst (thread-cell-ref current-servlet-instance)])
(unless inst (unless inst
(raise (make-exn:servlet:current-instance (raise (make-exn:servlet:no-current-instance "" (current-continuation-marks))))
"(lib \"servlet.ss\" \"web-server\") used outside the dynamic-extent of a servlet-instance"
(current-continuation-marks))))
inst)) inst))
;; adjust-timeout! : sec -> void ;; adjust-timeout! : sec -> void