开发者

Clojure content-type?

I am writing a web service that uses JSON or optional Clojure data expressions as the body format. The data is just to be read, not evaluated, if that matters. What would you recommend to use as MIME or Content-type for Clojure?

This is how far I came: Depending on how you look at it Clojure data might be Type "x", "text" or multipurpose "application":

application/clojure
text/clojure
application/x-clojure

At http://www.iana.org/assignments/media-types/ I could not even find a type for Lisp... (but then again Clojure is not Lisp).

There is of course the two versions

application/json
application/javascript

for JSON and JavaScript, depending on if the d开发者_Python百科ata will be evaluated.


Standards are established as much by use as by design. If the text you're sending is a clojure form, then I'm inclined to think application/clojure is fine. The one reservation I have would be distinguishing executable code from literal data structures, much in the way application/javascript is distinguished from application/json.


I would suggest something around:

  • application/vnd.clojure-data
  • application/prs.jramb.clojure-data
  • text/vnd.clojure
  • text/prs.jramb.clojure

see The part 3.2 and 3.3 from rfc4288 and the wikipedia entry

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜