标签:str request blog res read response 支持 api ssi
具体看代码:
@RequestMapping("/testServletAPI") public void testServletAPI(HttpServletRequest request, HttpServletResponse response,HttpSession session, Write r out) throws IOException{ System.out.println(request); System.out.println(response); System.out.println(session); out.write("hello"); }
代码解析:
很明显,要使用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
标签:str request blog res read response 支持 api ssi
原文地址:https://www.cnblogs.com/jasonZh/p/8761273.html