private Charset getCharset() { final String encoding = getCharacterEncoding(); if (encoding == null || !Charset.isSupported(encoding)) { return StandardCharsets.ISO_8859_1; } return Charset.forName(encoding); }
private WrappedServletRequest(HttpServletRequest request, InputStream inputStream) throws IOException { super(request); this.input = new WrappedServletInputStream(inputStream); this.reader = new BufferedReader(new InputStreamReader(input, getCharset())); }
private WrappedServletRequest wrapDeflatedRequest(HttpServletRequest request) throws IOException { final Inflater inflater = buildInflater(); try { final InflaterInputStream input = new InflaterInputStream(request.getInputStream(), inflater, inputBufferSize) { @Override public void close() throws IOException { super.close(); localInflater.set(inflater); } }; return new WrappedServletRequest(request, new ZipExceptionHandlingInputStream(input, DEFLATE)); } catch (IOException e) { throw ZipExceptionHandlingInputStream.handleException(DEFLATE, e); } }
private WrappedServletRequest wrapGzippedRequest(HttpServletRequest request) throws IOException { try { final GZIPInputStream input = new GZIPInputStream(request.getInputStream(), inputBufferSize); return new WrappedServletRequest(request, new ZipExceptionHandlingInputStream(input, GZIP)); } catch (IOException e) { throw ZipExceptionHandlingInputStream.handleException(GZIP, e); } }