I hadn't seen that.  Thanks!<br><br><div class="gmail_quote">On Tue, Mar 29, 2011 at 6:52 AM, Lou Vanek <span dir="ltr"><<a href="mailto:lou.vanek@gmail.com">lou.vanek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You can still dispatch on request method but you have to write a few<br>
lines of code.<br>
<br>
Did you look at the /info test example that comes with HT? Look at the<br>
7th line of the table produced by this test URL. All the information<br>
is there that you need in order to perform a branch on request method.<br>
<br>
<br>
::: URL: /localhost/info?abc=123<br>
<br>
Information Page<br>
<br>
This page has been called once since its handler was compiled.<br>
<br>
Some Information provides about this request:<br>
<br>
(HUNCHENTOOT:HOST)<br>
<br>
<br>
<br>
"localhost:8088"<br>
<br>
(HUNCHENTOOT:ACCEPTOR-ADDRESS WEB::*SERVER*)<br>
<br>
<br>
<br>
NIL<br>
<br>
(HUNCHENTOOT:ACCEPTOR-PORT WEB::*SERVER*)<br>
<br>
<br>
<br>
8088<br>
<br>
(HUNCHENTOOT:REMOTE-ADDR*)<br>
<br>
<br>
<br>
"127.0.0.1"<br>
<br>
(HUNCHENTOOT:REMOTE-PORT*)<br>
<br>
<br>
<br>
55593<br>
<br>
(HUNCHENTOOT:REAL-REMOTE-ADDR)<br>
<br>
<br>
<br>
"::1",<br>
("::1")<br>
<br>
(HUNCHENTOOT:REQUEST-METHOD*)<br>
<br>
<br>
<br>
:GET<br>
<br>
(HUNCHENTOOT:SCRIPT-NAME*)<br>
<br>
<br>
<br>
"/info"<br>
<br>
(HUNCHENTOOT:QUERY-STRING*)<br>
<br>
<br>
<br>
"abc=123"<br>
<br>
(HUNCHENTOOT:GET-PARAMETERS*)<br>
<br>
<br>
<br>
(("abc" . "123"))<br>
<br>
(HUNCHENTOOT:HEADERS-IN*)<br>
<br>
<br>
<br>
((:HOST . "localhost:8088")<br>
 (:USER-AGENT<br>
  . "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13)<br>
Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")<br>
 (:ACCEPT . "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")<br>
 (:ACCEPT-LANGUAGE . "en-us,en;q=0.5") (:ACCEPT-ENCODING . "gzip,deflate")<br>
 (:ACCEPT-CHARSET . "ISO-8859-1,utf-8;q=0.7,*;q=0.7")<br>
 (:COOKIE . "hunchentoot-session=1%3A6B0FCEA500DFA94C56F6273D56006E9D")<br>
 (:AUTHORIZATION . "Basic bG91OjEyM2E=") (:X-FORWARDED-FOR . "::1")<br>
 (:X-FORWARDED-HOST . "localhost") (:X-FORWARDED-SERVER . "::1")<br>
 (:CONNECTION . "Keep-Alive"))<br>
<br>
(HUNCHENTOOT:COOKIES-IN*)<br>
<br>
<br>
<br>
(("hunchentoot-session" . "1:6B0FCEA500DFA94C56F6273D56006E9D"))<br>
<br>
(HUNCHENTOOT:USER-AGENT)<br>
<br>
<br>
<br>
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206<br>
Ubuntu/10.10 (maverick) Firefox/3.6.13"<br>
<br>
(HUNCHENTOOT:REFERER)<br>
<br>
<br>
<br>
NIL<br>
<br>
(HUNCHENTOOT:REQUEST-URI*)<br>
<br>
<br>
<br>
"/info?abc=123"<br>
<br>
(HUNCHENTOOT:SERVER-PROTOCOL*)<br>
<br>
<br>
<br>
:HTTP/1.1<br>
<div><div></div><div class="h5"><br>
On Tue, Mar 29, 2011 at 4:19 AM, Jim Barrows <<a href="mailto:jim.barrows@gmail.com">jim.barrows@gmail.com</a>> wrote:<br>
> I have a uri "/my-uri", when a get request is made I want to return whatever<br>
> information I have, and when a post request made, I want to update that<br>
> information.<br>
> I had thought that doing this:<br>
> (define-easy-handler(get-business :uri "/business" :default-request-type<br>
> :get)()<br>
> (with-html-output-to-string (*standard-output* nil :prologue nil :indent t)<br>
> (format t "{\"success\":true, \"data\": ~a}"<br>
> (encode-json-plist-to-string (business::find-business)))))<br>
> (define-easy-handler(post-business :uri "/business" :default-request-type<br>
> :post) (business-name)<br>
> (with-html-output-to-string( *standard-output* nil :prologue nil :indent t)<br>
> (format t "post-business - ~a" business-name)))<br>
> would accomplish that.  However, the second handler is always called, for<br>
> the get and the post.<br>
> I'm new to Lisp, and was wondering what I'm missing.<br>
> Any help would be greatly appreciated.<br>
> --<br>
> James A Barrows<br>
><br>
><br>
</div></div><div><div></div><div class="h5">> _______________________________________________<br>
> tbnl-devel site list<br>
> <a href="mailto:tbnl-devel@common-lisp.net">tbnl-devel@common-lisp.net</a><br>
> <a href="http://common-lisp.net/mailman/listinfo/tbnl-devel" target="_blank">http://common-lisp.net/mailman/listinfo/tbnl-devel</a><br>
><br>
<br>
_______________________________________________<br>
tbnl-devel site list<br>
<a href="mailto:tbnl-devel@common-lisp.net">tbnl-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/tbnl-devel" target="_blank">http://common-lisp.net/mailman/listinfo/tbnl-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>James A Barrows<br><br>