Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9D20C200B81 for ; Tue, 13 Sep 2016 11:07:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9BA28160AC6; Tue, 13 Sep 2016 09:07:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E335F160AD2 for ; Tue, 13 Sep 2016 11:07:09 +0200 (CEST) Received: (qmail 72091 invoked by uid 500); 13 Sep 2016 09:07:08 -0000 Mailing-List: contact dev-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 dev@cxf.apache.org Received: (qmail 72066 invoked by uid 99); 13 Sep 2016 09:07:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Sep 2016 09:07:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A3226181353; Tue, 13 Sep 2016 09:07:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id oYy-7RTeFwCE; Tue, 13 Sep 2016 09:07:04 +0000 (UTC) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id A22A15FC4F; Tue, 13 Sep 2016 09:07:03 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id 1so188781069wmz.1; Tue, 13 Sep 2016 02:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=PR/hn5U8zcyraAm/v2RMleRfoU4wJTYTsxtje9/EYYE=; b=ZeLKKd/rF2v2N2vg7BkxnbEoUAIXRdG9nyIYRXW0nnoiil/1Ca2P4if4tyTVbzYK3n zkkp396IAKnKpYeg5H9E/Vx3zyU3GXpN8dO7ZffXzXPUPjkfkURrFZuPrbmwah4RV+eq H9zfSMLF+wNL7I+C5dMwZRCuq7AYCAQ0bitJWNImRvEdo2NCkMSY2oF321xmS35TiJyI cU5g66BAGKB9cdroTu/52a8raVWlGRiSQbGQ0Hw5xzwbcyaX+8zix+nyZVjIcwlB6z+5 PS8iJGHg/ZbdMUl47SI0SBgqmDlVlOh8qXs+0x6j8TsaXvS8kQiEKhcIdD18SKTSOq7u 0GsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=PR/hn5U8zcyraAm/v2RMleRfoU4wJTYTsxtje9/EYYE=; b=h9/ZA9mMdaCgtObAPcBxZ+20iWhthkJO1aRdlYA6IKT4waT74rNtMdngUlrjIkQJdz YlOqaW+0LoRNe2xW8/pT0PwMaRx4RAIbVHY+0bNwTxj7qNW+J3DQsgHrolSRfDmFTUDF hvDEm/E+0d6t99Sv/t9qg3VU+I9iHaTm6+zcqJG/e4uOhspuXxrUQ1A1KOFMyKHjisH3 K1Rvcif/7s4gxlkNdi5M+s1DL0l0ZVuZWhQr2wsI75oNrcRjT9W4daNIVvSO19CRo6T2 btWn5FjuhEMso1kN8YIdXNiyEVoXDse5EY04f/ULuK32n5Xhn9Xxh/hdHKm+gPRU4Au1 CqQw== X-Gm-Message-State: AE9vXwMtcIlpIQnWTu3OuAQjddXAmJphpe12FLLyjyWSjDckv0EKs3zco66mrYZk6uOw1Q== X-Received: by 10.194.43.98 with SMTP id v2mr20844109wjl.46.1473757617115; Tue, 13 Sep 2016 02:06:57 -0700 (PDT) Received: from [192.168.2.7] ([79.97.121.181]) by smtp.googlemail.com with ESMTPSA id p13sm1879516wmd.1.2016.09.13.02.06.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 02:06:56 -0700 (PDT) Subject: Re: Question - Who closes the InputStream? To: users References: <96fb492238755a009313836183f5003b@mail.gmail.com> <24ad209b-ca31-3de5-296f-a6a767a02be6@gmail.com> <725bf1b62e1c6c244ec3187b4aa7f32d@mail.gmail.com> <600d05c4-c16f-6dc5-1441-9208fcdc4725@gmail.com> <5edada5e2298aff3548ada6a6941dba0@mail.gmail.com> Cc: dev@cxf.apache.org From: Sergey Beryozkin Message-ID: <31ec8e28-0ad9-7c7d-0052-bee35967dbf1@gmail.com> Date: Tue, 13 Sep 2016 10:06:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <5edada5e2298aff3548ada6a6941dba0@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit archived-at: Tue, 13 Sep 2016 09:07:10 -0000 Which Attachment constructor you are using ? I've looked at the code, the treatment of the 'object' property is a bit inconsistent on the client side, it was added mainly for the server code when you can do InputStream is = attachment.getObject(InputStream.class); or, read InputStream into a custom object like Book with the registered providers: Book is = attachment.getObject(Book.class); etc On the client side 'object' and 'dataHandler' properties are the same, but I see one constructor not initializing 'object' - 'object' is never used on the client side to get the attachment processed. Work with attachment.getDataHandler(), or if you have an access to the code which creates these attachments then simply close InputStream from that code... Sergey On 12/09/16 23:43, Adam Decatur wrote: > Awesome, thank you! As I am looping over each attachment in the multipart > is there an easy to determine which ones are an InputStream? The following > doesn't seem to work. > > Object obj = attachment.getObject(); > > if (obj instanceof InputStream) > { > ... > } > > > > -----Original Message----- > From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] > Sent: Monday, September 12, 2016 3:49 PM > To: dev@cxf.apache.org; users > Subject: Re: Question - Who closes the InputStream? > > Yes, and if you use the async invoker then I guess you can close it > immediately after a reference to a Future is returned > > Sergey > On 12/09/16 21:46, Adam Decatur wrote: >> Yes, I am referring to client-side code. Cool, so I have get a >> response back from the Web service I should go ahead and close the stream? >> >> -----Original Message----- >> From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] >> Sent: Monday, September 12, 2016 3:41 PM >> To: users >> Cc: Daniel Kulp >> Subject: Re: Question - Who closes the InputStream? >> >> Hi >> >> Thanks for this question, forwarding to the users. >> Are you referring to the client side code ? If yes then indeed your >> code should close the streams once a call doing the upload returns. >> >> Cheers, Sergey >> On 12/09/16 21:31, Adam Decatur wrote: >>> Hello, >>> >>> >>> I am developing a Maven JAR in Eclipse that posts a Multipart to a >>> rest-based web-service. The multipart contains 2 or more Attachments. >>> The Attachments are being constructed with an InputStream. Do I need >>> to take care of closing these InputStreams? Or does CXF Apache do >>> this for me? >>> >>> >>> >>> Thank you, >>> >>> >>> >>> Adam >>> >>> >>> >>> *Adam Decatur* >>> Enterprise Software >>> >>> *O* +1 913 227 1812** >>> >>> *M* +1 330 506 0610** >>> >>> adam.decatur@lexmark.com >>> >>> http://www.lexmark.com/common/images/email/lexmark-logo-email-signatu >>> r >>> e.png >>> >>> www.lexmark.com >>> >>> >>> >> >> >> -- >> Sergey Beryozkin >> >> Talend Community Coders >> http://coders.talend.com/ >> > > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/