Hi,
I'm looking at parameter-test in the test.lisp examples. One thing I don't understand is, why do we have to recompute it in user code, instead of determining the correct content-type in initialize-instance :after and do the right thing there?
Maybe there's a reason behind this?
Thanks, -- Mac
(defun parameter-test (&key (method :get) (charset :iso-8859-1)) ....... (recompute-request-parameters :external-format (case charset (:iso-8859-1 +latin-1+) (:utf-8 +utf-8+)))
(defmethod initialize-instance :after ((request request) &rest init-args) ........ (setq post-parameters ........ (form-url-encoded-list-to-alist ;; *** we can examine headers here and pass the correct content type to form-url-encoded-list-to-alist
(defun form-url-encoded-list-to-alist (form-url-encoded-list &optional (external-format *tbnl-default-external-format*))
On Thu, 27 Oct 2005 18:26:02 -0700, Mac Chan emailmac@gmail.com wrote:
I'm looking at parameter-test in the test.lisp examples. One thing I don't understand is, why do we have to recompute it in user code, instead of determining the correct content-type in initialize-instance :after and do the right thing there?
Hi!
I think I don't fully understand the question. Do you suggest that we actually don't need (to export) RECOMPUTE-REQUEST-PARAMETERS and that this could always be handled correctly by TBNL itself? How would you do that?
Cheers, Edi.
I think I don't fully understand the question. Do you suggest that we actually don't need (to export) RECOMPUTE-REQUEST-PARAMETERS and that this could always be handled correctly by TBNL itself? How would you do that?
Hi Edi,
Sorry it was my mistake. Somehow I thought that the client would also include a "content-type" header when sending a http post or get. Apparently this is not the case.
BTW, this is my first time I post on this list, but I have been using your libraries for a while. They all come with top notch documentation. Thank you very much for the great code! Your website also contains a lot of useful lisp pointers for newbies.
Regards, -- Mac
http://localhost:3000/tbnl/test/parameter_utf8_post.html
POST /tbnl/test/parameter_utf8_post.html HTTP/1.1 Host: localhost:3000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:3000/tbnl/test/parameter_utf8_post.html Content-Type: application/x-www-form-urlencoded Content-Length: 8 foo=test
On Sun, 30 Oct 2005 19:11:28 -0800, Mac Chan emailmac@gmail.com wrote:
Sorry it was my mistake. Somehow I thought that the client would also include a "content-type" header when sending a http post or get. Apparently this is not the case.
Yep, unfortunately.
BTW, this is my first time I post on this list, but I have been using your libraries for a while. They all come with top notch documentation. Thank you very much for the great code! Your website also contains a lot of useful lisp pointers for newbies.
You're welcome... :)
Cheers, Edi.