Package spark.utils
Class GzipUtils
java.lang.Object
spark.utils.GzipUtils
GZIP utility class.
- Author:
- Edward Raff, Per Wendel
-
Method Summary
Modifier and TypeMethodDescriptionstatic OutputStreamcheckAndWrap(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, boolean requireWantsHeader) Checks if the HTTP request/response accepts and wants GZIP and i that case wraps the response output stream in aGZIPOutputStream.
-
Method Details
-
checkAndWrap
public static OutputStream checkAndWrap(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, boolean requireWantsHeader) throws IOException Checks if the HTTP request/response accepts and wants GZIP and i that case wraps the response output stream in aGZIPOutputStream.- Parameters:
httpRequest- the HTTP servlet request.httpResponse- the HTTP servlet response.requireWantsHeader- if wants header is required- Returns:
- if accepted and wanted a
GZIPOutputStreamotherwise the unchanged response output stream. - Throws:
IOException- in case of IO error.
-