⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nobodyresponse.java

📁 java servlet2.5 源码,对于学习servlet机制的人大为有用.
💻 JAVA
字号:
// Decompiled by DJ v3.8.8.85 Copyright 2005 Atanas Neshkov  Date: 2007-7-29 14:29:45
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   HttpServlet.java

package javax.servlet.http;

import java.io.*;
import java.util.Locale;
import javax.servlet.ServletOutputStream;

// Referenced classes of package javax.servlet.http:
//            NoBodyOutputStream, HttpServletResponse, Cookie

class NoBodyResponse
    implements HttpServletResponse
{

    NoBodyResponse(HttpServletResponse r)
    {
        resp = r;
        noBody = new NoBodyOutputStream();
    }

    void setContentLength()
    {
        if(!didSetContentLength)
            resp.setContentLength(noBody.getContentLength());
    }

    public void setContentLength(int len)
    {
        resp.setContentLength(len);
        didSetContentLength = true;
    }

    public void setCharacterEncoding(String charset)
    {
        resp.setCharacterEncoding(charset);
    }

    public void setContentType(String type)
    {
        resp.setContentType(type);
    }

    public String getContentType()
    {
        return resp.getContentType();
    }

    public ServletOutputStream getOutputStream()
        throws IOException
    {
        return noBody;
    }

    public String getCharacterEncoding()
    {
        return resp.getCharacterEncoding();
    }

    public PrintWriter getWriter()
        throws UnsupportedEncodingException
    {
        if(writer == null)
        {
            OutputStreamWriter w = new OutputStreamWriter(noBody, getCharacterEncoding());
            writer = new PrintWriter(w);
        }
        return writer;
    }

    public void setBufferSize(int size)
        throws IllegalStateException
    {
        resp.setBufferSize(size);
    }

    public int getBufferSize()
    {
        return resp.getBufferSize();
    }

    public void reset()
        throws IllegalStateException
    {
        resp.reset();
    }

    public void resetBuffer()
        throws IllegalStateException
    {
        resp.resetBuffer();
    }

    public boolean isCommitted()
    {
        return resp.isCommitted();
    }

    public void flushBuffer()
        throws IOException
    {
        resp.flushBuffer();
    }

    public void setLocale(Locale loc)
    {
        resp.setLocale(loc);
    }

    public Locale getLocale()
    {
        return resp.getLocale();
    }

    public void addCookie(Cookie cookie)
    {
        resp.addCookie(cookie);
    }

    public boolean containsHeader(String name)
    {
        return resp.containsHeader(name);
    }

    /**
     * @deprecated Method setStatus is deprecated
     */

    public void setStatus(int sc, String sm)
    {
        resp.setStatus(sc, sm);
    }

    public void setStatus(int sc)
    {
        resp.setStatus(sc);
    }

    public void setHeader(String name, String value)
    {
        resp.setHeader(name, value);
    }

    public void setIntHeader(String name, int value)
    {
        resp.setIntHeader(name, value);
    }

    public void setDateHeader(String name, long date)
    {
        resp.setDateHeader(name, date);
    }

    public void sendError(int sc, String msg)
        throws IOException
    {
        resp.sendError(sc, msg);
    }

    public void sendError(int sc)
        throws IOException
    {
        resp.sendError(sc);
    }

    public void sendRedirect(String location)
        throws IOException
    {
        resp.sendRedirect(location);
    }

    public String encodeURL(String url)
    {
        return resp.encodeURL(url);
    }

    public String encodeRedirectURL(String url)
    {
        return resp.encodeRedirectURL(url);
    }

    public void addHeader(String name, String value)
    {
        resp.addHeader(name, value);
    }

    public void addDateHeader(String name, long value)
    {
        resp.addDateHeader(name, value);
    }

    public void addIntHeader(String name, int value)
    {
        resp.addIntHeader(name, value);
    }

    /**
     * @deprecated Method encodeUrl is deprecated
     */

    public String encodeUrl(String url)
    {
        return encodeURL(url);
    }

    /**
     * @deprecated Method encodeRedirectUrl is deprecated
     */

    public String encodeRedirectUrl(String url)
    {
        return encodeRedirectURL(url);
    }

    private HttpServletResponse resp;
    private NoBodyOutputStream noBody;
    private PrintWriter writer;
    private boolean didSetContentLength;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -