SpringMVC中获取Servlet原生API

记录SpringMVC中获取Servlet原生API的方法。下面是一个获取原生API方法的代码。

public String testServlet(HttpServletRequest request,HttpServletResponse response){
     
        System.out.println(request);

        HttpSession session = request.getSession();
        System.out.println(session);
        
        ServletContext servletContext = session.getServletContext();
        System.out.println(servletContext);
        
        System.out.println(response);
        

    }

你可能感兴趣的:(SpringMVC,java,servlet)