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

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

?? compressionservletresponsewrapper.java

?? 中央認證服務器例子可以設置在casexample中包含所需要的東西。
?? 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:33 $
 */

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一区二区三区免费野_久草精品视频
午夜精品123| 一区二区三区免费在线观看| 成人黄色综合网站| 天天综合色天天综合色h| 久久亚洲精品国产精品紫薇 | 粉嫩嫩av羞羞动漫久久久| 亚洲激情在线播放| 久久男人中文字幕资源站| 欧美色中文字幕| 国产999精品久久久久久绿帽| 亚洲第一搞黄网站| 一区精品在线播放| 久久精品视频免费观看| 欧美精品自拍偷拍动漫精品| 成+人+亚洲+综合天堂| 蜜桃视频一区二区三区| 亚洲免费色视频| 欧美国产日本视频| 精品免费国产一区二区三区四区| 色综合天天综合| 丁香天五香天堂综合| 麻豆国产欧美一区二区三区| 亚洲午夜精品17c| 亚洲日本va在线观看| 久久久精品免费免费| 国产精品视频你懂的| 3d成人h动漫网站入口| 99精品国产视频| 不卡一区二区在线| 国产伦精品一区二区三区免费迷 | 7777精品伊人久久久大香线蕉的 | av一区二区三区黑人| 国产精品一区一区三区| 奇米综合一区二区三区精品视频 | 日韩电影免费一区| 亚洲h在线观看| 亚洲国产精品久久久男人的天堂| 亚洲欧美激情小说另类| 中文字幕在线观看一区| 国产亚洲福利社区一区| 亚洲精品在线免费播放| 欧美va天堂va视频va在线| 日韩视频在线永久播放| 日韩三级在线观看| 精品日本一线二线三线不卡| 精品对白一区国产伦| 日韩欧美一级精品久久| 91精品久久久久久久99蜜桃| 欧美精品国产精品| 日韩三级免费观看| 精品成人a区在线观看| 精品久久久久久久人人人人传媒 | 成人精品小蝌蚪| 国产超碰在线一区| 成人免费观看av| av在线不卡电影| 91丝袜国产在线播放| 色综合婷婷久久| 欧美日韩精品欧美日韩精品一| 欧美日韩三级一区二区| 69久久夜色精品国产69蝌蚪网| 91精品久久久久久久99蜜桃 | 亚洲激情欧美激情| 午夜视频在线观看一区二区| 日本亚洲一区二区| 奇米777欧美一区二区| 国产美女一区二区三区| 99久久精品国产精品久久| 日本高清视频一区二区| 欧美日韩dvd在线观看| 日韩午夜电影av| 中文子幕无线码一区tr| 一区二区三区在线视频播放| 日日夜夜精品视频免费| 色噜噜偷拍精品综合在线| 欧美日韩国产综合视频在线观看| 日韩视频一区二区在线观看| 久久久亚洲国产美女国产盗摄| 国产精品国产三级国产专播品爱网| 中文字幕亚洲一区二区va在线| 亚洲少妇30p| 日产精品久久久久久久性色| 久久精品国产999大香线蕉| 精东粉嫩av免费一区二区三区| 盗摄精品av一区二区三区| 91小视频免费观看| 欧美一级片在线| 精品国产乱码久久久久久图片| 国产精品久久久久久一区二区三区 | 色综合一个色综合亚洲| 欧美日韩一区三区四区| 欧美成人女星排名| 国产精品久久久久永久免费观看 | 最近日韩中文字幕| 亚洲影视在线播放| 国产成人免费视频网站高清观看视频 | 亚洲午夜影视影院在线观看| 极品美女销魂一区二区三区 | 日本亚洲天堂网| 91免费在线看| 日韩欧美一区二区三区在线| 日韩毛片在线免费观看| 日韩不卡一二三区| 一本大道久久精品懂色aⅴ| 91精品福利在线一区二区三区 | 激情另类小说区图片区视频区| 91在线观看美女| 日韩一区二区免费在线观看| 久久久久久免费网| 五月天婷婷综合| 福利一区福利二区| 欧美一级欧美一级在线播放| 亚洲免费观看高清完整版在线 | 国产精品久99| 久久精品国产亚洲aⅴ| 色狠狠色噜噜噜综合网| 精品99一区二区三区| 亚洲一区二区不卡免费| 懂色av中文字幕一区二区三区| 欧美色综合影院| 亚洲欧洲日韩一区二区三区| 亚洲一区二区三区美女| 波多野结衣一区二区三区| 欧美绝品在线观看成人午夜影视| 亚洲视频资源在线| 久久精品国产精品亚洲红杏| 精品视频1区2区3区| 日本一区二区视频在线观看| 波多野结衣91| 91麻豆精品91久久久久久清纯| 国产精品久久久爽爽爽麻豆色哟哟| 美国欧美日韩国产在线播放| 色综合久久中文综合久久97| 亚洲国产精品v| 极品尤物av久久免费看| 欧美一区二区免费| 亚洲精品国产一区二区精华液 | 欧美亚洲一区二区在线| 国产精品乱码一区二三区小蝌蚪| 一区二区三区四区不卡在线| 成人app在线| 国产精品灌醉下药二区| 成人午夜碰碰视频| 国产精品福利一区| 成人福利视频在线看| 国产欧美久久久精品影院| 韩日av一区二区| 国产亚洲精久久久久久| 亚洲四区在线观看| 色综合久久九月婷婷色综合| 中文字幕一区三区| 99精品久久久久久| 亚洲色图丝袜美腿| 91麻豆国产福利在线观看| 亚洲人xxxx| 91亚洲国产成人精品一区二区三| 中文字幕日韩av资源站| 成人激情午夜影院| 国产精品私人自拍| 欧洲色大大久久| 亚洲成人www| 精品久久国产97色综合| 狠狠色狠狠色合久久伊人| 国产精品久久久久一区二区三区共 | 亚洲福利国产精品| 欧美一卡在线观看| 黄色精品一二区| 最新久久zyz资源站| 色天天综合色天天久久| 日韩电影在线观看电影| 91麻豆精品国产91久久久久| 久久99精品网久久| 国产成人精品aa毛片| 亚洲精品中文字幕乱码三区| 成av人片一区二区| 亚洲一区在线观看免费观看电影高清 | 亚洲电影一级片| 欧美一级一级性生活免费录像| 国产精品一级片在线观看| 国产精品精品国产色婷婷| 欧美午夜精品一区| 青青草国产成人99久久| 久久久久97国产精华液好用吗| 国产a区久久久| 亚洲制服丝袜av| 日韩美女天天操| 国产在线国偷精品产拍免费yy | 99re成人在线| 久久av老司机精品网站导航| 久久精品亚洲国产奇米99| 91成人在线精品| 石原莉奈在线亚洲二区| 久久精品欧美一区二区三区不卡 | 欧美大尺度电影在线| 99re亚洲国产精品| 日韩精品电影一区亚洲| 国产一区二区三区观看| 亚洲三级理论片| 精品日韩在线观看| 色狠狠av一区二区三区|