• Servlet-HttpServlet对象


    概述

    servlet-api 4.0.1版本

    常用方法

    HttpServlet

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {...}
    
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {...}
    
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) {...}
    
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) {...}
    
    protected void service(HttpServletRequest req, HttpServletResponse resp) {...} // 负责调用上面四种方法
    

    GenericServlet实现类

    public void init() throws ServletException {}
    
    public void destroy() {}
    
    public String getInitParameter(String name) {...}
    
    public Enumeration<String> getInitParameterNames() {}
    
    public ServletConfig getServletConfig() {...} // 获取ServletConfig对象
    
    public String getServletInfo() {...}
    
    public ServletContext getServletContext() {...} // 获取ServletContext对象
    
    public String getServletName() {...}
    
    public abstract void service(ServletRequest req, ServletResponse res) throws ServletException, IOException;
    

    ServletConfig接口

    servlet容器使用的servlet配置对象,用于在初始化期间将信息传递给servlet。

    public String getServletName(); // 接口
    
    public ServletContext getServletContext(); // 接口
    
    public String getInitParameter(String name); // 接口
    
    public Enumeration<String> getInitParameterNames(); // 接口
    

    Servlet接口

    public void init(ServletConfig config) throws ServletException; // 接口
    
    public void destroy(); // 接口
    
    public ServletConfig getServletConfig(); // 接口
    
    public String getServletInfo(); // 接口
    
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException; // 接口
    
  • 相关阅读:
    python3 str.encode bytes.decode
    GTX 1080显卡出错
    Android studio2.2 app:transformNative_libsWithStripDebugSymbolForDebug
    psmisc
    How to configure locales to Unicode in a Docker Ubuntu 14.04 container?
    keras中文文档笔记1——概述
    keras中的一些小tips(一)
    基于Theano的深度学习(Deep Learning)框架Keras学习随笔-01-FAQ
    Android studio 更新android SDK
    groovy基础
  • 原文地址:https://www.cnblogs.com/shenleg/p/14254458.html
Copyright © 2020-2023  润新知