REST_return form

extract:

  "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.

  • Returns a response in HTML format
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 }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325072960&siteId=291194637