Skip to content
Open

Dev5 #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

<description>PMD 7.8.0 规则集</description>


<!-- 规则引用 -->
<rule ref="category/java/bestpractices.xml">
<exclude name="GuardLogStatement"/>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/org/joychou/controller/Fastjson.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
@Controller
@RequestMapping("/fastjson")
public class Fastjson {

@RequestMapping(value = "/deserialize", method = {RequestMethod.POST})
@ResponseBody
public String Deserialize(@RequestBody String params) {
// 如果Content-Type不设置application/json格式,post数据会被url编码
try {
// 将post提交的string转换为json
JSONObject ob = JSON.parseObject(params);
return ob.get("name").toString();
} catch (Exception e) {
return e.toString();
}
}

public static void main(String[] args) {
// Open calc in mac
Expand Down