code: @Override
      public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
          if (!context.getHeaders().containsKey(HttpHeaders.CONTENT_LENGTH)) {
              Object entity = context.getEntity();
              StreamingProcess<Object> process = MessageHelper.getStreamingProcess(entity, manager);
  
              if (process != null) {
                  long length = process.length(entity);
  
                  if (length != -1)
                      context.getHeaders().putSingle(HttpHeaders.CONTENT_LENGTH, length);
              }
          }
  
          context.proceed();
      }
docs: {@inheritDoc}