It turns out I used this code to start my local dev server using
appengine.server/start-server:
(start-server index :directory "./war" :join? false :port 8080)
forgot to replace index with the new "app". It works fine now, post
arguments are correctly captured.

By the way, when deploying the project it seems compojure somehow uses
java.rmi.server.UID if you use compojure.handler, and on app engine
java.rmi.server.UID is not usable. I'm using ring.middleware to
construct a proper usable handler for appengine, like this: (Almost
the same as (site index) except that I don't use wrap-multipart, which
probably uses that package)

(def app (-> index
             wrap-keyword-params
             wrap-nested-params
             wrap-params
             wrap-cookies
             wrap-session))

Seems to work without problems on appengine so far, hope it might be
useful for people googling about similar errors.

On Feb 17, 7:02 pm, James Reeves <jree...@weavejester.com> wrote:
> On 17 February 2011 03:13, Zhenchao Li <cockneyke...@gmail.com> wrote:
>
> > This is how I define my app:
>
> > (defroutes index
> >   (GET "/" [] (main-page))
> >   (GET "/form" [] (render-page "Vote" (render-form)))
> >   (POST "/vote" {params :params} (post-vote params))
> >   (route/not-found "Page not found"))
>
> > (def app (site index))
>
> > (defservice app)
>
> > The site here is used to capture :params, which is new in compojure
> > 0.6.0. However I'm getting a empty map in post-vote. I wonder what's
> > wrong with the above code? Any suggestions? Hints?
>
> There's nothing wrong with the above code in principle. The problem
> likely lies either in your render-form function, or your post-vote
> function.
>
> Try running the following routes:
>
> (defroutes main-routes
>   (GET "/" [] "Main Page")
>   (GET "/form" []
>     (str "<form method='post' action='/vote'>"
>          "<input type='text' name='test'>"
>          "<input type='submit'>"
>          "</form>"))
>   (POST "/vote" {params :params}
>     (pr-str params))
>   (route/not-found "Page not found"))
>
> If you go to "/form" and submit the form there, you should get a page
> that looks something like:
>
>   {:test "foo"}
>
> - James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to