} else if ("application/gzip".equals(partContentType)) {
in = new GZIPInputStream(in);
} else if ("application/x-gzip".equals(partContentType)) {
in = new GZIPInputStream(in);
} else if ("application/bzip2".equals(partContentType)) {
in = new BZip2CompressorInputStream(in);
} else if ("application/x-bzip2".equals(partContentType)) {
in = new BZip2CompressorInputStream(in);
}
reader = new InputStreamReader(in, Charsets.UTF_8);
} else {
String charEncodingName = request.getCharacterEncoding();
Charset charEncoding = charEncodingName == null ? Charsets.UTF_8 : Charset.forName(charEncodingName);
String contentEncoding = request.getHeader(HttpHeaders.CONTENT_ENCODING);
if (contentEncoding == null) {
reader = request.getReader();
} else if ("gzip".equals(contentEncoding)) {
reader = new InputStreamReader(new GZIPInputStream(request.getInputStream()), charEncoding);
} else if ("zip".equals(contentEncoding)) {
reader = new InputStreamReader(new ZipInputStream(request.getInputStream()), charEncoding);
} else if ("bzip2".equals(contentEncoding)) {
reader = new InputStreamReader(new BZip2CompressorInputStream(request.getInputStream()), charEncoding);
} else {
response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Unsupported Content-Encoding");
return;
}