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

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

?? compressionservletresponsewrapper.java

?? 這是基于 XLoadTree 的一個強大功能的展示的例子, 文件個頭也不大, 主要功能集中在 Web 前臺. 最終目標是實現一個易于使用的像 Windows 資源管理器那樣管理遠程 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 beansoft.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");
        }
        
        try {
        	((CompressionResponseStream)stream).flush();
		} catch (Exception e) {
			// TODO: handle exception
		}
        

    }

    /**
     * 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一区二区三区免费野_久草精品视频
亚洲二区在线观看| 中文字幕中文字幕中文字幕亚洲无线| 性感美女极品91精品| 欧美日韩美女一区二区| 亚洲成年人影院| 在线播放中文一区| 美女国产一区二区| 久久亚洲综合色| 成人av网站免费观看| 亚洲激情中文1区| 欧美日韩电影在线播放| 精品中文字幕一区二区| 国产欧美一区二区精品秋霞影院| 国产suv精品一区二区883| 中文字幕一区免费在线观看| 欧美日韩一区在线观看| 久久国产视频网| 国产精品久久久久久户外露出| 色综合网站在线| 国产伦精品一区二区三区免费迷 | 欧美精品亚洲二区| 麻豆91在线观看| 中文字幕乱码日本亚洲一区二区| 一本一道久久a久久精品综合蜜臀| 偷拍一区二区三区四区| 久久影音资源网| 欧美中文字幕亚洲一区二区va在线| 日韩成人av影视| 中文字幕一区二区三区在线观看 | 亚洲三级电影网站| 69堂成人精品免费视频| 成人免费观看男女羞羞视频| 亚洲观看高清完整版在线观看| 久久亚洲综合av| 91女神在线视频| 国产一区二区三区美女| 亚洲国产精品久久久久秋霞影院| 久久婷婷国产综合国色天香| 欧美日韩一区 二区 三区 久久精品| 精品午夜一区二区三区在线观看| 亚洲欧美aⅴ...| 久久婷婷色综合| 欧美肥胖老妇做爰| 91色porny蝌蚪| 国产乱码精品一区二区三| 亚洲精品欧美综合四区| 亚洲精品在线电影| 5566中文字幕一区二区电影| 色网综合在线观看| 国产成人免费视| 麻豆精品在线看| 日日夜夜一区二区| 亚洲精品视频在线观看免费| 国产片一区二区三区| 欧美成人女星排名| 欧美日韩精品是欧美日韩精品| 91美女福利视频| 国产乱子伦视频一区二区三区| 麻豆成人av在线| 奇米影视一区二区三区小说| 亚洲一区二区av在线| 麻豆精品视频在线观看免费| 亚洲大片一区二区三区| 亚洲一区在线播放| 综合中文字幕亚洲| 国产精品久久福利| 国产精品毛片久久久久久| 欧美刺激脚交jootjob| 制服丝袜av成人在线看| 欧美日韩一区二区在线观看| 一本到不卡免费一区二区| av在线播放成人| 国产精品美女一区二区在线观看| 26uuu精品一区二区在线观看| 日韩欧美国产一区二区三区| 91超碰这里只有精品国产| 在线观看日韩高清av| 欧美综合在线视频| 欧美三级电影在线看| 欧美日韩亚洲高清一区二区| 欧美日韩中文字幕一区| 欧美人成免费网站| 91精品国产黑色紧身裤美女| 欧美一区二区免费观在线| 欧美成人综合网站| 久久久久久久久久久黄色| 国产日本一区二区| 国产精品久久久久久久久搜平片 | 国产成人精品三级麻豆| 国产电影一区在线| 成人美女视频在线看| 成+人+亚洲+综合天堂| 99re视频精品| 欧美视频一区二区三区| 91精品国产综合久久久久久久| 日韩视频一区在线观看| 久久久久久麻豆| 亚洲欧洲精品一区二区精品久久久 | 国产麻豆一精品一av一免费 | 欧美精品777| 欧美成人video| 国产精品欧美综合在线| 一区二区三区视频在线看| 五月激情丁香一区二区三区| 久久电影网电视剧免费观看| 成人av综合在线| 欧美三级电影在线看| 欧美精品一区二区三区蜜桃视频 | 亚洲综合久久久| 免费在线一区观看| 成人动漫一区二区| 欧美色涩在线第一页| 久久综合色鬼综合色| 亚洲免费观看高清在线观看| 日本色综合中文字幕| 成人高清视频在线观看| 欧美乱妇15p| 国产精品灌醉下药二区| 日本欧美一区二区三区| 大胆亚洲人体视频| 欧美一区二视频| 国产欧美综合色| 日本aⅴ免费视频一区二区三区| 国产福利一区二区三区视频 | 亚洲精品你懂的| 激情五月婷婷综合| 91国偷自产一区二区三区成为亚洲经典 | 国产精品综合在线视频| 欧美无人高清视频在线观看| 国产清纯白嫩初高生在线观看91 | 亚洲卡通动漫在线| 激情小说欧美图片| 欧美日本不卡视频| 中文字幕在线一区二区三区| 老司机精品视频在线| 欧洲一区二区三区免费视频| 久久久久九九视频| 日av在线不卡| 在线影院国内精品| 中文字幕亚洲成人| 国产成人av电影在线| 911精品国产一区二区在线| 中文字幕亚洲精品在线观看| 国产精品99久久久久久久女警| 777精品伊人久久久久大香线蕉| 亚洲婷婷国产精品电影人久久| 国产精品一区二区你懂的| 欧美一区日本一区韩国一区| 亚洲综合色在线| 99久久精品国产网站| 久久精品人人做人人爽97| 男女性色大片免费观看一区二区| 欧美综合一区二区| 亚洲精品国产无天堂网2021| 成人精品免费网站| 国产精品每日更新在线播放网址| 国产精品自产自拍| 亚洲精品一区二区三区四区高清| 奇米777欧美一区二区| 欧美乱熟臀69xxxxxx| 午夜影院久久久| 欧美在线观看禁18| 亚洲综合在线免费观看| 91亚洲午夜精品久久久久久| 国产精品的网站| av不卡免费在线观看| 国产精品每日更新在线播放网址| 成人中文字幕在线| 亚洲国产电影在线观看| 国产98色在线|日韩| 国产精品夫妻自拍| 色88888久久久久久影院野外| 亚洲欧美色图小说| 欧美色中文字幕| 日韩福利电影在线观看| 制服丝袜成人动漫| 黄色精品一二区| 国产欧美一区二区三区在线看蜜臀 | 日韩精品在线网站| 激情欧美日韩一区二区| 国产三级一区二区| 成人性生交大片免费看中文 | 久久精品一区二区三区不卡牛牛| 国产高清在线精品| 亚洲色图丝袜美腿| 欧美色男人天堂| 美国三级日本三级久久99| 久久久高清一区二区三区| 懂色av中文字幕一区二区三区| 亚洲人123区| 4438亚洲最大| 国产精品456| 亚洲一区在线观看免费观看电影高清 | 青青国产91久久久久久| 久久综合久色欧美综合狠狠| 成人av网址在线观看| 日韩国产欧美在线观看| 久久精品人人做人人爽人人| 一本色道**综合亚洲精品蜜桃冫| 日韩精品福利网|