Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C638A100D0 for ; Wed, 23 Oct 2013 15:13:54 +0000 (UTC) Received: (qmail 49597 invoked by uid 500); 23 Oct 2013 15:13:45 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 49398 invoked by uid 500); 23 Oct 2013 15:13:43 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 49374 invoked by uid 99); 23 Oct 2013 15:13:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Oct 2013 15:13:42 +0000 Date: Wed, 23 Oct 2013 15:13:42 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CXF-5349) Provide ability to disable chunked transfer encoding for java.io.File entity MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-5349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sergey Beryozkin resolved CXF-5349. ----------------------------------- Resolution: Fixed Assignee: Sergey Beryozkin Unfortunately won't fix as getSize() has been deprecated. I can still do it for CXF 2.7.x only if you'd like to continue with the getSize() option while on CXF 2.7.x, before migrating to CXF 3.0.0, please reopen and set Fix version to 2.7.8 if you'd like me to do it, thanks > Provide ability to disable chunked transfer encoding for java.io.File entity > ---------------------------------------------------------------------------- > > Key: CXF-5349 > URL: https://issues.apache.org/jira/browse/CXF-5349 > Project: CXF > Issue Type: Improvement > Components: JAX-RS > Affects Versions: 2.7.7 > Reporter: Fabien Thouny > Assignee: Sergey Beryozkin > > As it was done for byte array in CXF-4760, it will be nice to be able to disable chunked transfer encoding for java.io.File entity in BinaryDataProvider. > I tried to provide a custom BinaryDataProvider as a workaround : > {code} > @Component > @Provider > public class CustomBinaryDataProvider extends BinaryDataProvider { > @Override > public long getSize(Object t, Class type, Type genericType, Annotation[] annotations, MediaType mt) { > if (File.class.isAssignableFrom(t.getClass())) { > return ((File) t).length(); > } > return super.getSize(t, type, genericType, annotations, mt); > } > } > {code} > but it seems not to be enough because there's an explicit check in JAXRSUtils#writeMessageBody to put the "Content-Length" header only for byte arrays : > {code} > MessageBodyWriter writer = ((WriterInterceptorMBW)writers.get(0)).getMBW(); > if (type == byte[].class) { > long size = writer.getSize(entity, type, genericType, annotations, mediaType); > if (size != -1) { > httpHeaders.putSingle(HttpHeaders.CONTENT_LENGTH, Long.toString(size)); > } > } > writer.writeTo(entity, type, genericType, annotations, mediaType, > httpHeaders, entityStream); > {code} > Thanks for your help, > Fabien -- This message was sent by Atlassian JIRA (v6.1#6144)