Skip to content

Commit 088180f

Browse files
committed
test
1 parent 044dfbf commit 088180f

File tree

4 files changed

+57
-11
lines changed

4 files changed

+57
-11
lines changed

src/main/java/cn/com/ttblog/ssmbootstrap_table/controller/JsonpController.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import java.io.IOException;
44
import java.util.Arrays;
5+
import java.util.Map;
56
import java.util.concurrent.Callable;
67
import java.util.concurrent.TimeUnit;
78
import javax.annotation.Resource;
89
import javax.servlet.http.HttpServletRequest;
910
import javax.servlet.http.HttpServletResponse;
1011
import javax.servlet.http.HttpSession;
12+
13+
import org.apache.commons.io.IOUtils;
1114
import org.apache.commons.lang3.builder.ToStringBuilder;
1215
import org.slf4j.Logger;
1316
import org.slf4j.LoggerFactory;
@@ -248,7 +251,25 @@ public User t(@PathVariable Long id, HttpServletRequest request,
248251
logger.debug("receive json obj:{}",user);
249252
return user;
250253
}
251-
254+
255+
//接收JSONObject
256+
@RequestMapping("/receiveJSONObject")
257+
public @ResponseBody
258+
Map receivejsonobj(@RequestBody JSONObject user,HttpServletRequest request) {
259+
logger.debug("receiveJSONObject:{}",user);
260+
return user;
261+
262+
}
263+
264+
//接收Map
265+
@RequestMapping("/receiveMap")
266+
public @ResponseBody
267+
Map receivejsonobj(@RequestBody Map user,HttpServletRequest request) {
268+
logger.debug("receiveMap:{}",user);
269+
return user;
270+
271+
}
272+
252273
/**
253274
* 获取session中name的值
254275
*
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package cn.com.ttblog.ssmbootstrap_table.servlet;
2+
3+
import org.apache.commons.io.IOUtils;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
7+
import javax.servlet.ServletException;
8+
import javax.servlet.annotation.WebServlet;
9+
import javax.servlet.http.HttpServlet;
10+
import javax.servlet.http.HttpServletRequest;
11+
import javax.servlet.http.HttpServletResponse;
12+
import java.io.IOException;
13+
14+
@WebServlet(name = "Servlet",urlPatterns = "/testservlet")
15+
public class TestServlet extends HttpServlet{
16+
17+
private static final Logger LOG= LoggerFactory.getLogger(TestServlet.class);
18+
19+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
20+
21+
}
22+
23+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
24+
LOG.debug("doget");
25+
response.getWriter().write("hello");
26+
}
27+
}

src/main/resources/spring/spring-ehcache.xml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans xmlns="http://www.springframework.org/schema/beans"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
4-
xmlns:context="http://www.springframework.org/schema/context"
5-
xmlns:cache="http://www.springframework.org/schema/cache"
6-
xsi:schemaLocation="http://www.springframework.org/schema/beans
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:p="http://www.springframework.org/schema/p"
5+
xmlns:cache="http://www.springframework.org/schema/cache"
6+
xsi:schemaLocation="http://www.springframework.org/schema/beans
77
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
8-
http://www.springframework.org/schema/context
9-
http://www.springframework.org/schema/context/spring-context-3.2.xsd
10-
http://www.springframework.org/schema/cache
11-
http://www.springframework.org/schema/cache/spring-cache-3.2.xsd
12-
">
8+
http://www.springframework.org/schema/cache
9+
http://www.springframework.org/schema/cache/spring-cache-3.2.xsd">
1310
<!-- http://blog.csdn.net/clj198606061111/article/details/41121437 -->
1411
<cache:annotation-driven cache-manager="cacheManager" />
1512
<!-- idea中需要设置p:shared="true",eclipse不需要设置,否则出错,原因不明...-->
1613
<bean id="cacheManagerFactory"
17-
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
14+
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:shared="true">
1815
<property name="configLocation" value="classpath:ehcache.xml" />
1916
</bean>
2017

src/main/webapp/WEB-INF/web.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
/*/image/**
123123
/*/jsonp/**
124124
/*/cxf/**
125+
/testservlet
125126
</param-value>
126127
</init-param>
127128
</filter>

0 commit comments

Comments
 (0)