标签:
具体看代码:
1 @RequestMapping("/testServletAPI") 2 public void testServletAPI(HttpServletRequest request, 3 HttpServletResponse response,HttpSession session, 4 Write r out) throws IOException{ 5 System.out.println(request); 6 System.out.println(response); 7 System.out.println(session); 8 out.write("hello"); 9 }
代码解析:
很明显,要使用Sevlet的一些API,只要直接将其作为参数传入即可。你需要request,就传入request, 需要session,就传入session。springmvc支持传入的Sevlet原生api一共有以下这些:
1. HttpServletRequest
2. HttpServletResponse
3. HttpSession
4. java.security.Principal
5. Locale
6. InputStream
7. OutputStream
8. Reader
9. Writer
标签:
原文地址:http://www.cnblogs.com/caoyc/p/5635701.html