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格式的响应
@Controller
//@RestController
public class RestDemo { /**
* 这里返回HTML
* path和value属性可以在org.springframework.web.bind.annotation.RequestMapping看到
* 这两个属性互相为别名
* 且这两个属性都是数组,可以放多个可能的值
* 从spring4.3引入了GetMapping接口,简化RequestMapping对get请求的处理
* @RestController = @Controller + @ResponseBody()
*/
//@RequestMapping(value={"/html/demo","/html/demo2"})
//@RequestMapping(path={"/html/demo","/html/demo2"})
@GetMapping(value={"html/demo3","html/demo4"})
@ResponseBody()
public String htmlCode(){
return "<html><body>hello world</body></html>";
}
}
REST_返回形式的更多相关文章
- spring boot 搭建web项目常见五种返回形式
在web项目中一般常见的五种返回形式: 返回页面,使用模板引擎,spring boot推荐使用thymeleaf,类似的还有freemarker等. 返回字符串(json),一般用于完全的前后端分离开 ...
- ajax struts2 数据的返回形式
这篇随笔算是接上篇的数据请求返回,上一篇关于分页用的返回的数据形式是json,http://www.cnblogs.com/tele-share/p/7192206.html这次主要探讨ajax从st ...
- springmvc<一>一种资源返回多种形式【ContentNegotiatingViewResolver】
restful服务中一个重要的特性就是一种资源可以有多种表现形式,在springmvc中可以使用ContentNegotiatingViewResolver这个视图解析器来实现这种方式. 描述资源的三 ...
- 浅谈WebService返回数据效率对比
原文链接 http://www.dotnetgeek.cn/xuexiwebservice1.html 一.什么是WebService: 简单通俗来说,就是企业之间.网站之间通过Internet来访问 ...
- json接口返回值
SpringBoot响应客户端渲染数据 1.SpringBoot构造并且返回一个json对象 首先,我们在父包下新建一个pojo的包,并新建一个User类 IDEA自动生成对应的get/set,然后 ...
- 12)django-ORM(单表返回数据3种方式)
单表查询还回数据有3种形式,返回形式不一样,模板调用方式不同 1)返回Queryset里面内容为对象:Business.objects.all() 这里内容显示是对象 2)返回Queryset里面内容 ...
- 【接口开发】浅谈 SOAP Webserver 与 Restful Webserver 区别
接口,强大,简单,交互,跨越平台 下面简单阐述这两大接口思想 一 REST: REST是一种架构风格,其核心是面向资源,REST专门针对网络应用设计和开发方式,以降低开发的复杂性,提高系统的可伸缩性. ...
- python-time 模块
1.时间戳是以秒为单位的浮点小数,时间戳以自1970年1月1日午夜到现在经过了的时间来表示 2.时间模块引入方式:import time 3.返回时间戳 time.time() 4.返回时间元组:ti ...
- jQuery源码分析系列(36) : Ajax - 类型转化器
什么是类型转化器? jQuery支持不同格式的数据返回形式,比如dataType为 xml, json,jsonp,script, or html 但是浏览器的XMLHttpRequest对象对数据的 ...
随机推荐
- linux硬件数据
Linux 文件详解 lrwxrwxrwx root root 8月 bin -> usr/bin //二进制目录 存放了许多GNU用户极工具 dr-xr-xr-x. root root 8月 ...
- 【数模】day06-数理统计I
数理统计. 以样本推断总体,进而用总体研究问题. 分两部分学习,第一部分是基础统计.参数估计.假设检验以及bootstrap方法. 1. 基础统计 假设有如下数据: 要做频数表.直方图.折线图.饼状图 ...
- Codeforces Round #445 Div. 1
A:每次看是否有能走回去的房间,显然最多只会存在一个,如果有走过去即可,否则开辟新房间并记录访问时间. #include<iostream> #include<cstdio> ...
- Codeforces Global Round 1 自闭记
A:签到. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> ...
- android最最基础简单的保存xml代码
y偶遇非常基础,我想直接上代码: MainActivity.java: package com.lgqchinese.xmlcreate; import android.support.v7.app. ...
- ☆ [POJ2559] Largest Rectangle in a Histogram 「单调栈」
类型:单调栈 传送门:>Here< 题意:给出若干宽度相同的矩形的高度(条形统计图),求最大子矩形面积 解题思路 单调栈的经典题 显然,最终的子矩形高度一定和某一个矩形相等(反证).因此一 ...
- C/C++ 程序库
C/C++ 程序库 // --------------------------------------------- 来几个不常见但是很变态的库吧: bundle: 把几乎所有常见的压缩库封装成了一个 ...
- ubuntu18.4 中 mysql5.7 全完卸载与安装
卸载 sudo apt-get autoremove --purge mysql-server-5.7 sudo apt-get remove mysql-server sudo apt-get au ...
- 【HDU - 5790 】Prefix(主席树+Trie树)
BUPT2017 wintertraining(15) #7C 题意 求[min((Z+L)%N,(Z+R)%N)+1,max((Z+L)%N,(Z+R)%N)+1]中不同前缀的个数,Z是上次询问的结 ...
- android sqlite boolean 类型
sql语句中 boolean (bit)类型的字段 ,insert 数据的时候 , 有null ,0 (false),1(true) 三个数可以选择. 例如: insert into pos valu ...