@Override
 public Object aroundReadFrom(ReaderInterceptorContext context)
     throws IOException, WebApplicationException {
   final InputStream originalInputStream = context.getInputStream();
   context.setInputStream(new GZIPInputStream(originalInputStream));
   return context.proceed();
 }
Beispiel #2
0
 @Override
 public Object aroundReadFrom(ReaderInterceptorContext context)
     throws IOException, WebApplicationException {
   try {
     return context.proceed();
   } catch (IOException e) {
     return "OK";
   }
 }
 @Override
 public Object aroundReadFrom(ReaderInterceptorContext context)
     throws IOException, WebApplicationException {
   Object encoding = context.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
   if (encoding != null && encoding.toString().equalsIgnoreCase("gzip")) {
     InputStream old = context.getInputStream();
     FinishableGZIPInputStream is =
         new FinishableGZIPInputStream(
             old, context instanceof ServerReaderInterceptorContext, getMaxSize());
     context.setInputStream(is);
     try {
       return context.proceed();
     } finally {
       // Don't finish() an InputStream - TODO this still will require a garbage collect to finish
       // the stream
       // see RESTEASY-554 for more details
       if (!context.getType().equals(InputStream.class)) is.finish();
       context.setInputStream(old);
     }
   } else {
     return context.proceed();
   }
 }