集册 Java实例教程 用户是否在HttpServletRequest中禁用了gzip(例如用于基准测试)

用户是否在HttpServletRequest中禁用了gzip(例如用于基准测试)

欢马劈雪     最近更新时间:2020-01-02 10:19:05

567
用户是否在HttpServletRequest中禁用了gzip(例如用于基准测试)


import java.io.IOException;

import java.io.PrintWriter;

import java.util.zip.GZIPOutputStream;/* from 时代Java*/

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;


public class Main{

    /** Has user disable gzip (e.g., for benchmarking)? */

    public static boolean isGzipDisabled(HttpServletRequest request) {


        String flag = request.getParameter("disabledGzip");

        return ((flag !=
展开阅读全文