集册 Java实例教程 是Gzip支持的HttpServletRequest

是Gzip支持的HttpServletRequest

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

557
是Gzip支持的HttpServletRequest
//NowJava.com - 时代Java

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.util.zip.*;


public class Main{

    public static boolean isGzipSupported(HttpServletRequest request) {

        String encodings = request.getHeader("Accept-Encoding");

        return ((encodings != null) && (encodings.indexOf("gzip") != -1));

    }

}