Really Simple Noob Question

257 views
Skip to first unread message

David Simmons

unread,
Jan 2, 2014, 1:22:44 PM1/2/14
to clojure-...@googlegroups.com
Hi 

I'm following the tutorial but am stuck on the first example - the one with a route of ANY "/" (resource).


When I point my browser at localhost:3000 I receive the message "No acceptable resource available". I'm sure I must be doing something very obviously wrong but can't work it out.

Any help would be gratefully received.

cheers

Dave

David Park

unread,
Jan 2, 2014, 1:40:40 PM1/2/14
to clojure-...@googlegroups.com
Most likely, your resource is missing a declaration for acceptable media types.

Make sure your resource has something like:
(defresource my-resource
  :available-media-types ["text/html"])

If you are sending a request with an Accept header of "application/json", then you will want to add that media type to the :available-media-types vector

(defresource my-resource
  :available-media-types ["text/html" "application/json"])

If that doesn't get you out of your bind, then please reply with the full definition of your resource and we can check it out.

If you poke around in the source code, specifically src/liberator/core.clj, you will see other places where the 406 can be returned as a response, see the places where handle-not-acceptable is used as the result of a decision. There are tests for media type, encoding, charset, language, for example, that could result in a 406 not acceptable response.

Good luck!


--
You received this message because you are subscribed to the Google Groups "Liberator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-libera...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
David Park
(m) +1.317.270.4287
daviddpark at gmail dot com

David Simmons

unread,
Jan 2, 2014, 2:00:42 PM1/2/14
to clojure-...@googlegroups.com
David

that worked perfectly - thank you so much for your help.

I don't suppose you know who I need to contact to ask them to update the tutorial do you as this might catch out other newbies?

cheers

Dave

Adrian Mowat

unread,
Jan 3, 2014, 1:28:26 PM1/3/14
to clojure-...@googlegroups.com
Hi David,

I made some updates to the docs recently.  It's super-easy to do if don't mind making the changes yourself.


Hope this helps

Adrian

David Simmons

unread,
Jan 4, 2014, 4:43:16 AM1/4/14
to clojure-...@googlegroups.com
Thanks Adrian.

I'll give it a go over the weekend.

cheers

Dave

David Simmons

unread,
Jan 17, 2014, 3:10:47 PM1/17/14
to clojure-...@googlegroups.com
Hi Adrian

I may be being a bit slow tonight but I can't find the right git page for the website - do you know where it is?

cheers

Dave

Philipp Meier

unread,
Jan 17, 2014, 3:12:20 PM1/17/14
to clojure-...@googlegroups.com
Hi,

It's in the gh-pages branch of the liberator repository.

-billy.



David Simmons <shortl...@gmail.com> schrieb:

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Adrian Mowat

unread,
Jan 18, 2014, 7:28:17 AM1/18/14
to clojure-...@googlegroups.com
Hi David,

Sorry for the delay - you can get the documentation branch at https://github.com/clojure-liberator/liberator/tree/gh-pages

Adrian
Reply all
Reply to author
Forward
0 new messages