REST_返回形式

摘录:

  "Web resources" were first defined on the World Wide Web as documents or files identified by their URLs. However, today they have a much more generic and abstract definition that encompasses every thing or entity that can be identified, named, addressed, or handled, in any way whatsoever, on the web. In a RESTful web service, requests made to a resource's URI will elicit a response that may be in XML, HTML, JSON, or some other format. The response may confirm that some alteration has been made to the stored resource, and the response may provide hypertext links to other related resources or collections of resources. When HTTP is used, as is most common, the operations available are GET, POST, PUT, DELETE, and other predefined CRUD HTTP methods.

  • 返回HTML格式的响应
1 public class RestDemo {
2 
3     //HTML
4     @RequestMapping("/html/demo")
5     @ResponseBody()
6     public String htmlCode(){
7         return "<html><body>hello world</body></html>";
8     }
9 }

猜你喜欢

转载自www.cnblogs.com/rocker-pg/p/8975628.html
今日推荐