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")
(log-format parenthesized-default)
(messages
(servlet-message
"servlet-error.html")
(authentication-message
"forbidden.html")
(servlets-refreshed
"servlet-refresh.html")
(passwords-refreshed
"passwords-refresh.html")
(file-not-found-message
"not-found.html")
(protocol-message
"protocol-error.html")
(collect-garbage
"collect-garbage.html"))
(servlet-message "servlet-error.html")
(authentication-message "forbidden.html")
(servlets-refreshed "servlet-refresh.html")
(passwords-refreshed "passwords-refresh.html")
(file-not-found-message "not-found.html")
(protocol-message "protocol-error.html")
(collect-garbage "collect-garbage.html"))
(timeouts
(default-servlet-timeout 30)
(password-connection-timeout 300)
@ -28,14 +21,9 @@
(file-base-connection-timeout 30))
(paths
(configuration-root "conf")
(host-root
"default-web-root")
(log-file-path
"log")
(file-root
"htdocs")
(servlet-root
".")
(password-authentication
"passwords"))))
(host-root "default-web-root")
(log-file-path "log")
(file-root "htdocs")
(servlet-root ".")
(password-authentication "passwords"))))
(virtual-host-table))

View File

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

View File

@ -4,7 +4,7 @@
(lib "list.ss")
"timer.ss")
(provide (struct exn:servlet:instance ())
(struct exn:servlet:current-instance ())
(struct exn:servlet:no-current-instance ())
(struct exn:servlet:continuation (expiration-handler))
(struct servlet (handler namespace instance-expiration-handler))
(struct execution-context (connection request suspend))
@ -48,7 +48,7 @@
;; not found in the continuatin table
(define-struct (exn:servlet:continuation exn) (expiration-handler))
;; 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!)
(let ([id-slot 'next-k-id])

View File

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