Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 78424 invoked from network); 23 Jan 2011 18:49:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jan 2011 18:49:59 -0000 Received: (qmail 62784 invoked by uid 500); 23 Jan 2011 18:49:58 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 62680 invoked by uid 500); 23 Jan 2011 18:49:57 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 62672 invoked by uid 99); 23 Jan 2011 18:49:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Jan 2011 18:49:57 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sberyozkin@gmail.com designates 209.85.214.41 as permitted sender) Received: from [209.85.214.41] (HELO mail-bw0-f41.google.com) (209.85.214.41) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Jan 2011 18:49:53 +0000 Received: by bwz16 with SMTP id 16so2977283bwz.0 for ; Sun, 23 Jan 2011 10:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=bVA710P8wgrKc9T/aCfOKHP8E3Qpqc4655oym7DfKZE=; b=tIuADat+v7pd2tRzB/EgE4fvdahKfbYhl3cK+gXDSxHC82Ggyj07sREMOlH0HuM7v+ RIhy5axb7tAINt852Y3f8vUvDaP5rcCmXe8WF+x/0BdOzB+e/cZWEgg3d5dgYXrmKGDk ftfsW4l4JsPYn3xZvV35m7NONcFsGId2vN6e0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=kY4A3z+20MgaJBlYj0C4y7B2EoVLFvtJrxOCaQ3fOTK2GIanbaL7h47bOxTmsBQREF NC0rJ+8C1Kx8O9JfDLkVkmzApKjldaGlDH00Ea0oQkCXO8+YBTjBFwuXJ0a11xzDynxF jhZB1L2EV+v4lmLNGqDj1sfk0pkgfkRth7b74= MIME-Version: 1.0 Received: by 10.204.58.196 with SMTP id i4mr2715724bkh.119.1295808571119; Sun, 23 Jan 2011 10:49:31 -0800 (PST) Received: by 10.204.61.78 with HTTP; Sun, 23 Jan 2011 10:49:31 -0800 (PST) In-Reply-To: <001f01cbb94c$415dcaf0$c41960d0$@com> References: <001501cbb7c7$9a359990$cea0ccb0$@com> <002001cbb7cc$d688ebe0$839ac3a0$@com> <002401cbb7d8$6b03ef30$410bcd90$@com> <002201cbb88c$3ba6f200$b2f4d600$@com> <001f01cbb94c$415dcaf0$c41960d0$@com> Date: Sun, 23 Jan 2011 18:49:31 +0000 Message-ID: Subject: Re: JAX-RS Attachments size limit and temp folder From: Sergey Beryozkin To: users@cxf.apache.org Content-Type: multipart/alternative; boundary=001636c5ac69941768049a87f1d7 --001636c5ac69941768049a87f1d7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Ivan sorry for a delay On Fri, Jan 21, 2011 at 9:19 AM, Ivan Vitoria Sanchez wrote: > Hi Sergey, > > Could you tell me where i can find some example about how StaxSource work= s? > I'm not sure how can i use it in conjunction with JAXB... > > Me neither :-), Actually, I can see JAXBSource now exists : http://download.oracle.com/javase/6/docs/api/javax/xml/bind/util/JAXBSource= .html However I'm not sure if returning a JAXBSource will make writing large pieces of data more efficient. > Anyway, let me know as soon as you optimize the SourceProvider :) > I will :-) Cheers, Sergey > > Ivan > > -----Mensaje original----- > De: Sergey Beryozkin [mailto:sberyozkin@gmail.com] > Enviado el: jueves, 20 de enero de 2011 12:24 > Para: users@cxf.apache.org > Asunto: Re: JAX-RS Attachments size limit and temp folder > > Hi Ivan > > On Thu, Jan 20, 2011 at 10:24 AM, Ivan Vitoria Sanchez < > ivitoria@grupoica.com> wrote: > > > Hi Segey, > > > > Please see my comments below > > > > (I really appreciate your effort) > > > > Ivan > > > > > > > > > Does it mean that i can not use these jax-rs properties to get a > > generated > > > JAXB XML with a Base64-encoded file via GET request? > > > > > > You may need to experiment with different options here. > > > > 1. If you return a JAXB bean with the DataHandler then it looks like it > can > > definitely be XOP-packaged. > > Just set an "mtom-enabled" JAX-RS property to "true" and have > > @Produces("multipart/related"). > > Or is the consumer not capable of reading multiparts, is it a browser ? > > > > - Well, the client, which i'm developing too, is a Windows Mobile > > application, so I think XOP isn't supported out-of-the-box by Compact > > Framework 3.5 and I should develop a custom parser... > > > > > I see... > > > > 2. Return the big XML wrapped in the JAXP Source - it probably won't ma= ke > a > > difference right now; Dan explained to me that the JAX-WS > Provider > > is optimized on the write side, so I will look into it and enhance the > > JAX-RS SourceProvider accordingly. > > > > - isn't this like my scene? (do you remember the CXF-3022 bug?). what > kind > > of improvement would it be if you enhance the JAX-RS SourceProvider? > > > > In order to have the SourceProvider involved the method will need to ha= ve > a > Source return type. > I do not know right now. As far as I recall that if JAXP Source is return= ed > (as opposed to say StreamSource or DOMSource) then the JAX-WS runtime can > opt for using a CXF StaxSource which makes it easier to stream, so the > SourceProvider can do something similar. You may just want to experiment > and > explicitly return the CXF StaxSource, > > new StaxSource(StaxUtils.createXMLStreamReader(xmlInputStream)); > > > > 3. Return a link to the XML file on the disk and delegate to the > underlying > > container to serve the file to the consumer, you can configure the > > CXFServlet to delegate to the default servlet for doing it... > > > > - I'm not sure if this is a good solution for me > > > > 4. Return several links to individual XML sections (kept in memory or o= n > > the > > disk) - this could be one of the most efficient options for writing the > > large attachments > > > > - Are you talking about splitting up a Base64 Encoded XML attachment? > > > > > 3 and 4 are attempts to come with some alternative options. It all depend= s > on what sort of experience is provided to the users. I'm not sure right n= ow > what I'd do if I were to return a 50MB file. But I'd try to avoid writing > it > directly to the output stream representing the response to the current > invocation. What those XML data represent, the list of records ? For > example, I'd consider returning a fist section of the xml with the > attribute > containing a link to the next one, so that you can display the current > records and offer the option to browse to the next section. If this xml > blob > is not splittable then may be I'd consider using a > RequestDispatcherProvider > to redirect to the container which can be more optimized to serve large > files. > > But I'll definitely look into optimizing the SourceProvider... > > cheers, Sergey > > > I'd really like to > > > customize both input and output folders/sizes of attachments extracte= d > > > from/attached to XML messages. > > > > > > > > My understanding that at the moment it's only possible to do it on the > > input > > (assuming it is XOP in your case or 'plain' attachments). > > > > Let me know how it goes please > > Cheers, Sergey > > > > > > I've added the system properties and I've checked from code. However, t= he > > > temporal folder is still the same > > > > > > > > > > > > (C:\Users\ICA\.netbeans\6.9\apache-tomcat-6.0.26_base\temp\cxf-tmp-418517= \co > > > s970506463177488784tmp) and the size of the XML message is 15 MB! > > > > > > Thanks! > > > > > > > > > -----Mensaje original----- > > > De: Sergey Beryozkin [mailto:sberyozkin@gmail.com] > > > Enviado el: mi=E9rcoles, 19 de enero de 2011 13:09 > > > Para: users@cxf.apache.org > > > Asunto: Re: JAX-RS Attachments size limit and temp folder > > > > > > Hi Ivan > > > > > > Please see comments below: > > > > > > On Wed, Jan 19, 2011 at 11:34 AM, Ivan Vitoria Sanchez < > > > ivitoria@grupoica.com> wrote: > > > > > > > Hi Sergey, > > > > > > > > I'm not using XOP and yes, the properties 'attachment-directory' an= d > > > > 'attachment-memory-threshold' don't seem to have any effect. I've > also > > > > tried > > > > adding the VM options but the result is the same. > > > > > > > > Following you can find the Spring configuration and log output: > > > > > > > > > > > modelRef=3D"classpath:/WEB-INF/model/GenericModel.xml" abstract=3D"= true"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > value=3D"classpath:/WEB-INF/model/AttachmentModel.xml" /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------- > > > > Response-Code: 200 > > > > Content-Type: application/octet-stream > > > > Headers: {Date=3D[Wed, 19 Jan 2011 10:20:55 GMT], > > Content-Encoding=3D[gzip], > > > > Vary=3D[Accept-Encoding]} > > > > Messages: Outbound Message (saved to tmp file): > > > > Filename: > > > > > > > > > > > > > > > > > > > > C:\Users\ICA\.netbeans\6.9\apache-tomcat-6.0.26_base\temp\cxf-tmp-872111\= cos > > > > 4854851171655688610tmp > > > > (message truncated to 102400 bytes) > > > > > > > > Payload: omitted > > > > > > > > > > > > > > > AFAIK, These properties, "attachment-directory" and > > > "attachment-memory-threshold", are affecting reading the attachments > > only. > > > But it looks like you'd like them affecting writing the attachments ? > > > > > > Try setting the following system properties : > > > > > > -Dorg.apache.cxf.io.CachedOutputStream.Threshold=3DsomeValue > > > and > > > -Dorg.apache.cxf.io.CachedOutputStream.OutputDirectory=3D/temp/mobili= ty > > > > > > There must be the way to set these properties as jaxrs:properties too= , > > just > > > do not have an access to the code right now > > > > > > Let me know please if it helps > > > Cheers, Sergey > > > > > > > > > > Ivan > > > > > > > > > > > > > > > > -----Mensaje original----- > > > > De: Sergey Beryozkin [mailto:sberyozkin@gmail.com] > > > > Enviado el: mi=E9rcoles, 19 de enero de 2011 12:06 > > > > Para: users@cxf.apache.org > > > > Asunto: Re: JAX-RS Attachments size limit and temp folder > > > > > > > > Hi > > > > > > > > On Wed, Jan 19, 2011 at 10:56 AM, Ivan Vitoria Sanchez < > > > > ivitoria@grupoica.com> wrote: > > > > > > > > > Hi everyone, > > > > > > > > > > > > > > > > > > > > I'm developing a JAX-RS server (CXF 2.3.1) which performs both GE= T > > and > > > > POST > > > > > operations with DataHandler attachments within a bean, and it wor= ks > > > fine > > > > > (I'm not sending Multiparts). However, I could not set neither th= e > > temp > > > > > folder used as buffer nor the max size of the attachments as > > explained > > > in > > > > > http://cxf.apache.org/docs/jax-rs-multiparts.html ("Reading Large > > > > > Attachments" section). > > > > > > > > > > > > > > Are you using XOP ? Also, when you say you can not set, do you mean > the > > > > properties you set have no effect ? > > > > > > > > thanks, Sergey > > > > > > > > > > > > > > > > > > > > > > > Does it not work because it only applies to Multipart messages? I= f > > so, > > > > how > > > > > can i do it? > > > > > > > > > > > > > > > > > > > > Thanks in advance! > > > > > > > > > > > > > > > > > > > > Ivan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --001636c5ac69941768049a87f1d7--