九大内置对象的方法笔记

Request:
        Object getAttribute()
        Enumeration getAttributeNames()
        String getCharacterEncoding()
        Int getContentLength()
        String getContentType()
        ServletInputStream getInputStream()
        String getParameter(String name)
        Enumeration getParameterNames()
        String[] getParameterValues(String name)
        String getProtocol()
        String getSchema() //返回请求用的计划名,如http.https以及tfp等
        String getServerName()
        BufferedReader getReader() //返回解码过后的请求体
        String getRemoteAddr() //返回发送次请求的客户端IP地址
        String getRemoteHost() //返回发送次请求的客户端主机名
        Viod setAttribute(String key, Object obj)
        String getRealPath(String path)
Response:
        String getCharacterEncoding()
        ServletOutputStream getOutputStream()
        PrintWriter getWriter() //返回可以向客户端输出字符的一个对象
        Void setContentLength(int len)
        Void setContentType(String type)
        sendRedirect(java.lang.String location)
Session:
        Long getCreationTime()
        String getId()
        Long getLastAccessedTime()
        Int getMaxInactiveInterval()
        String g[] getValueNames()
        Viod invalidate() //取消SESSION,使SESSION不可用
        Boolean isNew() //返回服务器创建的一个session,客户端是否已经加入
        Void removeValue(String name)
        Void setMaxInactiveInterval() //设置两次请求间隔多长时间此session被取消
Out:
        Void clear()
        Void clearBuffer()
        Void flush()
        Int getBufferSize()
        Int getRemaining()
        Boolean isAutoFlush()
        Void close()
Page:
        Class getClass()
        Int hashCode() //返回对象的hash码
        Boolean equals(Object obj)
        Void copy(Object obj)
        Object clone()
        String toString()
        Void notify() // 唤醒一个等待的线程
        Void notifyAll() //唤醒所有等待的线程
        Void wait(int timeout) //使一个线程处于等待知道timeout结束或被唤醒
        Void wait() //使一个线程处于等待直到被唤醒
        Void enterMonitor() //对Object加锁
        Void exitMonitor() //对Object开锁
Application:
        Object getAttribute(String name)
        Enumeration getAttributeNames()
        Void setAttribute(String name, Object obj)
        Void removeAttribute(String name)
        String getServerInfo() //返回JSP(SERVLET)引擎名及版本号
        String getRealPath(String path)
        ServletContext getContext(String uriPath) //返回指定WebApplication的application对象
        Int getMajorVersion() //返回服务器支持的Servlet API的最大版本号
        Int getMajorVersion() //返回服务器支持的Servlet API的最小版本号
        String getMimeType(String file) //返回指定文件的MIME类型
        URL getResource(String path) //返回指定资源的URL路径
        InputStream getResourceAsStream(String path) //返回指定资源的输入流
        RequestDispatcher getRequestDispatcher(String uriPath) //返回指定资源的RequestDispatcher对象
        Servlet getServlet(String name) //返回指定名的Servlet
        Enumeration getServlets()
        Enumeratation getServletNames()
        Void log(String msg) //把指定消息写入Servlet的日志文件
        Void log(Exception exception, String msg) //把指定异常的栈轨迹机错误消息写入Servlet的日志文件
        Void log(String msg, Throwable throwable) //把栈轨迹及给出的Throwable异常的说明信息写入Servlet日子文件
Exception:
        String getMessage()
        String toString()
        Void printStackTrace()
        Throwable FillInStackTraces() //重写异常的执行栈轨迹
pageContext:
        JspWriter getOut()
        HttpSession getSession()
        Object getPage()
        ServletRequest getRequest()
        ServletResponse getResponse()
        Exception getException()
        ServletConfig getServletConfig()
        ServletContext getServletContext()
        Void setAttribute(String name, Object attribute)
        Void setAttribute(String name, Object attribute, int scope)
        Object getAttribute(String name)
        Object getAttribute(String name, int scope)
        Objet findAttribute(String name)
        Void removeAttribute(String name)
        Void removeAttribute(String name, int scope)
        Int getAttributeScope(String name)
        Enumeration getAttributeNamesInScope(int scope)
        Void releast()
        Void forward(String relativeUrlPath)
        Void include(String relativeUrlPath)
Config
        ServletContext getServletContext()
        String getInitParameter(String name)
        Enumeration getInitParameterNames()

路慢慢其休远羲,吾将上下而求所
原文地址:https://www.cnblogs.com/garinzhang/p/2509217.html