zoukankan      html  css  js  c++  java
  • 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; // 接口
    
  • 相关阅读:
    sudo 之后 unable to resolve host的问题解决办法
    Linux 查找具体的文件名称
    linux 访问远程务器代码
    spark 安装配置
    R基本介绍
    BIEE多层表头报表的制作方法
    支付宝新漏洞引发恐慌,那如何关闭小额免密支付呢
    大家注意了,支付宝被曝重大安全漏洞,回应称正在跟进排查
    2017年5个不应该被忽视的机器学习项目
    婚前最后一次加班
  • 原文地址:https://www.cnblogs.com/shenleg/p/14254458.html
Copyright © 2011-2022 走看看