请问 群里 有没有 用 webmachine, init 和 to_html 是必须的吗?
这个问题 困惑了 我一会。昨天就应该发现他们的本质,还好只拖到了今天开始
下面 默认提供的to_html方法,当然如果喜欢 可以改成to_htm
init是必须的 初始化用的
。。。。。
?
content_types_provided | [{"text/html", to_html}] | ? | [{Mediatype, Handler}] | This should return a list of pairs where each pair is of the form?{Mediatype, Handler}?where?Mediatype?is a string of content-type format and the?Handler?is an atom naming the function which can provide a resource representation in that media type. Content negotiation is driven by this return value. For example, if a client request includes an Accept header with a value that does not appear as a first element in any of the return tuples, then a 406 Not Acceptable will be sent. |