[hunchentoot-devel] Patch Submission: Custom Reason Phrases
Kari Lentz
karilentz at att.net
Wed Feb 1 03:17:20 UTC 2012
Included is a patch that incorporates the ability to have a request specific
reason phrase that allows one to use code such along the lines of
(setf (return-code*) (make-custom-status 500 "some database query error")))
This would override the templates and the cooked messages but only for that
request and is intended to be an answer to the "StatusDescription" member of
the HTTPResponse class in the ASP.NET library. Essentially, a custom-status-t
class has been added that links a code with a reason phrase. The
"make-custom-status" function above is just a constructor to this new class.
The "reason-phrase" function is now a generic method that dispatches off both
the custom-status-t class and the previous numeric status codes to be backward
compatible.
I also ended up changing the error code dispatch to be CLOS based using eql
dispatch instead of a case statement for the various http-status-code values.
It seems to be a trend to use generic functions instead of a case statement in
this situation, probably because of a hash table type dispatch is used behind
the scenes rather than going from start to finish as in a case statement.
Cheers,
Kari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20120131/a7341561/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-hunchen
Type: application/octet-stream
Size: 13632 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20120131/a7341561/attachment.obj>
More information about the Tbnl-devel
mailing list