Read a String Read string 'foo'
@RequestMapping(value="/string", method=RequestMethod.POST)
public @ResponseBody String readString(@RequestBody String string) {
return "Read string '" + string + "'";
}
Write a String Wrote a string
@RequestMapping(value="/string", method=RequestMethod.GET)
public @ResponseBody String writeString() {
return "Wrote a string";
}
Read a Form Read form map{foo=[bar], fruit=[apple]}
@RequestMapping(value="/form", method=RequestMethod.POST)
public @ResponseBody String readForm(@ModelAttribute JavaBean bean) {
return "Read x-www-form-urlencoded: " + bean;
}
JavaBean:
@XmlRootElement
public class JavaBean {
@NotNull
private String foo;
@NotNull
private String fruit;
}
Write a Form foo=bar&fruit=apple
@RequestMapping(value="/form", method=RequestMethod.GET)
public @ResponseBody MultiValueMap<String, String> writeForm() {
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.add("foo", "bar");
map.add("fruit", "apple");
return map;
}
JavaBean参考上面的
Read XML Read from XML Foo:bar, Fruit:apple
@RequestMapping(value="/xml", method=RequestMethod.POST)
public @ResponseBody String readXml(@RequestBody JavaBean bean) {
return "Read from XML: " + bean;
}
Write XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<javaBean>
<foo>bar</foo>
<fruit>apple</fruit>
</javaBean>
java:
@RequestMapping(value="/xml", method=RequestMethod.GET)
public @ResponseBody JavaBean writeXml() {
return new JavaBean("bar", "fruit");
}
Read JSON Read from JSON Foo:bar, Fruit:apple
@RequestMapping(value="/json", method=RequestMethod.POST)
public @ResponseBody String readJson(@Valid @RequestBody JavaBean bean) {
return "Read from JSON: " + bean;
}
Write JSON{"foo":"bar", "fruit":"apple"}
@RequestMapping(value="/json", method=RequestMethod.GET)
public @ResponseBody JavaBean writeJson() {
return new JavaBean("bar", "fruit");
}
Read Atom Read My Atom feed
@RequestMapping(value="/atom", method=RequestMethod.POST)
public @ResponseBody String readFeed(@RequestBody Feed feed) {
return "Read " + feed.getTitle();
}
Write Atom
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www/w3/org/2005/Atom">
<title>My Atom feed</title>
</feed>
@RequestMapping(value="/atom", method=RequestMethod.GET)
public @ResponseBody Feed writeFeed() {
Feed feed = new Feed();
feed.setFeedType("atom_1.0");
feed.setTitle("My Atom feed");
return feed;
}
Read Rss
@RequestMapping(value="/rss", method=RequestMethod.POST)
public @ResponseBody String readChannel(@RequestBody Channel channel) {
return "Read " + channel.getTitle();
}
Write Rss
@RequestMapping(value="/rss", method=RequestMethod.GET)
public @ResponseBody Channel writeChannel() {
Channel channel = new Channel();
channel.setFeedType("rss_2.0");
channel.setTitle("My RSS feed");
channel.setDescription("Description");
channel.setLink("http://localhost:8080/mvc-showcase/rss");
return channel;
}
分享到:
相关推荐
NULL 博文链接:https://lgbolgger.iteye.com/blog/2105151
ISSCC2021_Session_17V_DC-DC Converters.pdf
This is a tutorial on Spring MVC, a module in the Spring Framework for rapidly developing web applications. The MVC in Spring MVC stands for Model-View-Controller, a design pattern widely used in ...
Session_17_High_Speed_Data_Converters.pdf
simulink model of buck, boost, and flyback converters in open and closed loop
TI ADC芯片封装库,所有TI ADC芯片系列PCB封装 Texas_Instruments_Data_Converters_Analog_to_Digital_Converter
Advanced_Data_Converters--[248].pdf
sigma-delta调制器的经典之作,给需要的朋友
Sigma_Delta_Converters_Theory_Design_and_Simulation, 这本书是做Sigma Delta ADC 必看的书。
这个是一个simulink模型,采用六步方波控制BLDC,已经搭建好六步控制逻辑,将传统的电源替换成了一个BUCK电源,简单的调节PID参数即可跟踪给定转速。
MTR50参数PDF,可以参考,数据手册
一本不错关于Delta-Sigma转换器的书 Understanding Delta Sigma Data Converters
archive_ Google Blog Converters v1.0 r89 [江西新余电信].zip
raised if this happens. These operations are almost always triggered by interrupts as inListing 10.5 for the SPI.I provide yet another thermometer as an example in Listing 10.13. This uses the ADC ...
MySQLdb __init__.py converters.py mysql python
Switching-mode DC-DC buck converters
17.2.1. Setting up a message broker in Spring 17.2.2. Using Spring’s JMS template 17.2.3. Creating message-driven POJOs 17.2.4. Using message-based RPC 17.3. Messaging with AMQP 17.3.1. A brief ...
LLC_Converters_App_Note_Public (1)
A document for designing power converters by just using simulink
项目介绍 这是一个 springmvc + mybatis + jdbc 的基础项目 这里使用了 jackson-databind 包, spring-mvc转json的包 ... <artifactId>jackson-databind ...mvc:message-converters register-default