亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? compressionservletresponsewrapper.java

?? 這是一個基于web的新聞發布系統!用jsp做的
?? JAVA
字號:
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package compressionFilters;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Locale;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

/**
 * Implementation of <b>HttpServletResponseWrapper</b> that works with
 * the CompressionServletResponseStream implementation..
 *
 * @author Amy Roh
 * @author Dmitri Valdin
 * @version $Revision: 1.3 $, $Date: 2004/03/18 16:40:28 $
 */

public class CompressionServletResponseWrapper extends HttpServletResponseWrapper {

    // ----------------------------------------------------- Constructor

    /**
     * Calls the parent constructor which creates a ServletResponse adaptor
     * wrapping the given response object.
     */

    public CompressionServletResponseWrapper(HttpServletResponse response) {
        super(response);
        origResponse = response;
        if (debug > 1) {
            System.out.println("CompressionServletResponseWrapper constructor gets called");
        }
    }


    // ----------------------------------------------------- Instance Variables

    /**
     * Original response
     */

    protected HttpServletResponse origResponse = null;

    /**
     * Descriptive information about this Response implementation.
     */

    protected static final String info = "CompressionServletResponseWrapper";

    /**
     * The ServletOutputStream that has been returned by
     * <code>getOutputStream()</code>, if any.
     */

    protected ServletOutputStream stream = null;


    /**
     * The PrintWriter that has been returned by
     * <code>getWriter()</code>, if any.
     */

    protected PrintWriter writer = null;

    /**
     * The threshold number to compress
     */
    protected int threshold = 0;

    /**
     * Debug level
     */
    private int debug = 0;

    /**
     * Content type
     */
    protected String contentType = null;

    // --------------------------------------------------------- Public Methods


    /**
     * Set content type
     */
    public void setContentType(String contentType) {
        if (debug > 1) {
            System.out.println("setContentType to "+contentType);
        }
        this.contentType = contentType;
        origResponse.setContentType(contentType);
    }


    /**
     * Set threshold number
     */
    public void setCompressionThreshold(int threshold) {
        if (debug > 1) {
            System.out.println("setCompressionThreshold to " + threshold);
        }
        this.threshold = threshold;
    }


    /**
     * Set debug level
     */
    public void setDebugLevel(int debug) {
        this.debug = debug;
    }


    /**
     * Create and return a ServletOutputStream to write the content
     * associated with this Response.
     *
     * @exception IOException if an input/output error occurs
     */
    public ServletOutputStream createOutputStream() throws IOException {
        if (debug > 1) {
            System.out.println("createOutputStream gets called");
        }

        CompressionResponseStream stream = new CompressionResponseStream(origResponse);
        stream.setDebugLevel(debug);
        stream.setBuffer(threshold);

        return stream;

    }


    /**
     * Finish a response.
     */
    public void finishResponse() {
        try {
            if (writer != null) {
                writer.close();
            } else {
                if (stream != null)
                    stream.close();
            }
        } catch (IOException e) {
        }
    }


    // ------------------------------------------------ ServletResponse Methods


    /**
     * Flush the buffer and commit this response.
     *
     * @exception IOException if an input/output error occurs
     */
    public void flushBuffer() throws IOException {
        if (debug > 1) {
            System.out.println("flush buffer @ CompressionServletResponseWrapper");
        }
        ((CompressionResponseStream)stream).flush();

    }

    /**
     * Return the servlet output stream associated with this Response.
     *
     * @exception IllegalStateException if <code>getWriter</code> has
     *  already been called for this response
     * @exception IOException if an input/output error occurs
     */
    public ServletOutputStream getOutputStream() throws IOException {

        if (writer != null)
            throw new IllegalStateException("getWriter() has already been called for this response");

        if (stream == null)
            stream = createOutputStream();
        if (debug > 1) {
            System.out.println("stream is set to "+stream+" in getOutputStream");
        }

        return (stream);

    }

    /**
     * Return the writer associated with this Response.
     *
     * @exception IllegalStateException if <code>getOutputStream</code> has
     *  already been called for this response
     * @exception IOException if an input/output error occurs
     */
    public PrintWriter getWriter() throws IOException {

        if (writer != null)
            return (writer);

        if (stream != null)
            throw new IllegalStateException("getOutputStream() has already been called for this response");

        stream = createOutputStream();
        if (debug > 1) {
            System.out.println("stream is set to "+stream+" in getWriter");
        }
        //String charset = getCharsetFromContentType(contentType);
        String charEnc = origResponse.getCharacterEncoding();
        if (debug > 1) {
            System.out.println("character encoding is " + charEnc);
        }
        // HttpServletResponse.getCharacterEncoding() shouldn't return null
        // according the spec, so feel free to remove that "if"
        if (charEnc != null) {
            writer = new PrintWriter(new OutputStreamWriter(stream, charEnc));
        } else {
            writer = new PrintWriter(stream);
        }
        
        return (writer);

    }


    public void setContentLength(int length) {
    }


    /**
     * Returns character from content type. This method was taken from tomcat.
     * @author rajo
     */
    private static String getCharsetFromContentType(String type) {

        if (type == null) {
            return null;
        }
        int semi = type.indexOf(";");
        if (semi == -1) {
            return null;
        }
        String afterSemi = type.substring(semi + 1);
        int charsetLocation = afterSemi.indexOf("charset=");
        if(charsetLocation == -1) {
            return null;
        } else {
            String afterCharset = afterSemi.substring(charsetLocation + 8);
            String encoding = afterCharset.trim();
            return encoding;
        }
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美偷拍另类a∨色屁股| 蜜臀av性久久久久蜜臀aⅴ流畅| 精品成人佐山爱一区二区| 欧美色图12p| 欧美人与禽zozo性伦| 7777精品伊人久久久大香线蕉| 欧美视频你懂的| 91麻豆精品91久久久久同性| 欧美精品亚洲一区二区在线播放| 成人激情动漫在线观看| 久久se这里有精品| 国产精品99久久久| 成人app在线| 欧美日韩专区在线| 欧美一区二区三区免费大片| 精品国精品国产尤物美女| 精品久久久久久久久久久久久久久久久 | 久久精品免视看| 91精品国产综合久久久久| 色欧美乱欧美15图片| 成人自拍视频在线| 色综合久久六月婷婷中文字幕| 欧美体内she精高潮| 日韩一区二区三区在线视频| 久久久久国产精品麻豆ai换脸| 亚洲欧洲日本在线| 午夜视频在线观看一区二区| 亚洲综合图片区| 亚洲一区二区三区在线播放| 毛片不卡一区二区| 91老师片黄在线观看| 欧美日韩成人在线一区| 久久精品夜夜夜夜久久| 亚洲高清不卡在线观看| 国产一区二区三区免费| 欧美亚洲动漫另类| 国产性做久久久久久| 午夜国产精品一区| 成人美女视频在线看| 91精品国产色综合久久不卡蜜臀| 欧美高清在线一区| 琪琪久久久久日韩精品| 成人免费黄色在线| 日韩视频一区二区三区| 亚洲免费大片在线观看| 国产精品888| 欧美一级欧美一级在线播放| 亚洲视频综合在线| 国产精品 欧美精品| 777午夜精品免费视频| 亚洲欧洲韩国日本视频| 国产一区二区三区蝌蚪| 欧美裸体一区二区三区| 亚洲欧美色图小说| 成人影视亚洲图片在线| 日韩久久免费av| 偷窥少妇高潮呻吟av久久免费| 不卡一区在线观看| 国产视频不卡一区| 国内精品免费在线观看| 日韩一区二区视频在线观看| 亚洲国产一区视频| 欧美日韩一卡二卡三卡| 一区二区三区丝袜| 99精品在线观看视频| 国产精品日产欧美久久久久| 粉嫩高潮美女一区二区三区| 精品国产免费久久| 国内精品久久久久影院一蜜桃| 日韩女优av电影| 老司机精品视频在线| 欧美一个色资源| 亚洲成人动漫一区| 555夜色666亚洲国产免| 亚洲国产中文字幕| 欧美日本一区二区| 日韩电影在线观看网站| 日韩精品在线看片z| 日韩国产一二三区| 91精品国产全国免费观看| 亚洲成人动漫在线观看| 色香蕉久久蜜桃| 一区二区三区在线免费| 色婷婷一区二区三区四区| 中文字幕在线不卡视频| 色综合久久久久综合体桃花网| 亚洲色图一区二区| 91麻豆高清视频| 有码一区二区三区| 欧美日韩美女一区二区| 午夜伦欧美伦电影理论片| 欧美日韩一区不卡| 精品亚洲成a人在线观看| 日韩美女天天操| 午夜久久久影院| 在线观看av不卡| 麻豆国产精品一区二区三区 | 国产欧美一区二区三区在线看蜜臀| 精品亚洲国内自在自线福利| 国产精品五月天| 99热精品一区二区| 五月激情丁香一区二区三区| 精品福利一区二区三区免费视频| 不卡视频在线看| 亚洲成人1区2区| 久久久www成人免费毛片麻豆 | 一区二区三区在线不卡| 欧美日韩激情一区二区| 首页亚洲欧美制服丝腿| 日韩欧美色电影| 91网站最新地址| 蜜臀久久99精品久久久久宅男 | 精品裸体舞一区二区三区| 天天色 色综合| 亚洲国产成人午夜在线一区 | 亚洲国产一区二区视频| 精品国产sm最大网站免费看| www.在线成人| 青青草91视频| 亚洲欧洲av在线| 欧美女孩性生活视频| 精品一二三四区| 亚洲精品日韩一| 国产欧美日韩在线| 欧美精品亚洲一区二区在线播放| 国产精品系列在线播放| 日本少妇一区二区| 国产人伦精品一区二区| 欧美亚洲综合一区| 粉嫩一区二区三区性色av| 蜜桃视频第一区免费观看| 国产欧美精品一区| 91精品婷婷国产综合久久竹菊| 成人av免费在线观看| 久久精品二区亚洲w码| 一区二区三区不卡在线观看| 国产精品麻豆久久久| 久久久久国产精品人| 精品精品欲导航| 91精品国产乱码| 精品婷婷伊人一区三区三| 91丨porny丨国产| 99久久精品国产导航| 久久精品久久99精品久久| 亚洲一区二区三区免费视频| 亚洲欧美日韩系列| 中文字幕欧美日韩一区| 久久久亚洲综合| 国产日韩一级二级三级| 久久午夜老司机| 久久噜噜亚洲综合| ww亚洲ww在线观看国产| 欧美日本高清视频在线观看| 欧美日韩久久久| 日韩一区二区三区高清免费看看| 日韩午夜精品电影| 久久夜色精品国产噜噜av| 精品国产乱码久久久久久1区2区| 精品欧美一区二区久久| 久久精品亚洲乱码伦伦中文| 日韩欧美久久久| 精品入口麻豆88视频| 久久这里只有精品首页| 欧美激情一区在线| 亚洲欧美日韩在线不卡| 亚洲国产一区二区三区| 日本不卡123| 成人中文字幕在线| 91在线视频播放| 在线视频一区二区免费| 欧美日韩一级大片网址| 精品区一区二区| 中文字幕欧美国产| 亚洲成人av一区二区三区| 麻豆精品一区二区综合av| 麻豆精品国产91久久久久久| 国v精品久久久网| 91精品1区2区| 26uuu亚洲综合色欧美| 国产精品伦理在线| 亚洲国产精品一区二区尤物区| 日本aⅴ亚洲精品中文乱码| 国产精品一区二区在线观看网站| 99久久精品99国产精品| 日韩精品专区在线影院重磅| 国产女同性恋一区二区| 国产精品久久久久影院| 亚洲五月六月丁香激情| 国产九九视频一区二区三区| 99久久伊人久久99| 日本精品免费观看高清观看| 欧美一级日韩免费不卡| 亚洲麻豆国产自偷在线| 国产一区二区三区最好精华液| 色婷婷av一区二区三区之一色屋| 日韩网站在线看片你懂的| 一区二区三区在线免费| 国产成人综合视频| 日韩午夜在线观看| 亚洲国产乱码最新视频|