zoukankan      html  css  js  c++  java
  • Servlet(5)—ServletRequest接口和ServletResponse接口

    ServletRequest接口:
    使用ServletRequest接口创建对象,用于使客户端请求信息对Servlet可用,创建的对象作为参数传递之Servlet的Service()
    ServletRequest接口的方法:
    getAttribute(String)
    getAttributeNames()
    getCharacterEncoding()
    setCharacterEncoding(String)
    getContentLength()
    getContentType()
    getInputStream()
    getParameter(String)
    getParameterNames()
    getParameterValues(String)
    getParameterMap()
    getProtocol()
    getScheme()
    getServerName()
    getServerPort()
    getReader()
    getRemoteAddr()
    getRemoteHost()
    setAttribute(String, Object)
    removeAttribute(String)
    getLocale()
    getLocales()
    isSecure()
    getRequestDispatcher(String)
    getRealPath(String)
    getRemotePort()
    getLocalName()
    getLocalAddr()
    getLocalPort()
    getServletContext()
    startAsync()
    startAsync(ServletRequest, ServletResponse)
    isAsyncStarted()
    isAsyncSupported()
    getAsyncContext()
    getDispatcherType()

    ServletResponse接口:

    使用ServletResponse接口创建的对象用于向客户端提供响应,创建的对象作为参数传递至Servlet的service()方法,该接口中
    方法如下:
    getCharacterEncoding()
    getContentType()
    getOutputStream()
    getWriter()
    setCharacterEncoding(String)
    setContentLength(int)
    setContentType(String)
    setBufferSize(int)
    getBufferSize()
    flushBuffer()
    resetBuffer()
    isCommitted()
    reset()
    setLocale(Locale)
    getLocale()

  • 相关阅读:
    Hibernate 笔记 之 三 基础优化方面
    Hibernate 笔记 之 二 查询
    Hibernate 笔记 之 一 创建与配置
    hibernate初次配置及测试
    CentOS 7.3 安装MySQL--Java--Tomcat
    Spring AOP:自动注入参数值
    Spring AOP:实现Request信息获取
    IntelliJ IDEA导出项目文档
    IntelliJ IDEA:Shortcut Key
    iText生成PDF
  • 原文地址:https://www.cnblogs.com/tengpengfei/p/10453990.html
Copyright © 2011-2022 走看看