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; // 接口
    
  • 相关阅读:
    Codeforces Round 718C Sasha and Array (矩阵线段树)
    Ural Timus 1009 K-based Numbers (dp+矩阵快速幂+快速乘)
    CPE常用指令
    Error opening terminal:xterm解决方法
    编译MT7620n NFS文件系统
    ubuntu中把dash链接变成bash
    USB相关
    HI3515海思开发板移植3G模块笔记
    openwrt的一些琐事
    snprintf拷贝字符串
  • 原文地址:https://www.cnblogs.com/shenleg/p/14254458.html
Copyright © 2011-2022 走看看