日期:2014-05-20  浏览次数:20668 次

[求助]为什么HttpServlet中的方法基本都是protected?
Java code

protected  void doDelete(HttpServletRequest req, HttpServletResponse resp) 
          
protected  void doGet(HttpServletRequest req, HttpServletResponse resp) 
      
protected  void doHead(HttpServletRequest req, HttpServletResponse resp) 
          protected  void doOptions(HttpServletRequest req, HttpServletResponse resp) 
          
protected  void doPost(HttpServletRequest req, HttpServletResponse resp) 
          
protected  void doPut(HttpServletRequest req, HttpServletResponse resp) 
           
protected  void doTrace(HttpServletRequest req, HttpServletResponse resp) 
          
protected  long getLastModified(HttpServletRequest req) 

protected  void service(HttpServletRequest req, HttpServletResponse resp) 





------解决方案--------------------
可能是只给继承它的类公开这些方法吧,就是这么设计的吧,都是给servlet使用的吧,毕竟它是要继承HttpServlet的!