Hi
On Wed, Jan 19, 2011 at 12:57 PM, Ivan Vitoria Sanchez <
[email protected]> wrote:
> 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 ?
2. Return the big XML wrapped in the JAXP Source - it probably won't make a
difference right now; Dan explained to me that the JAX-WS Provider<Source>
is optimized on the write side, so I will look into it and enhance the
JAX-RS SourceProvider accordingly.
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...
4. Return several links to individual XML sections (kept in memory or on the
disk) - this could be one of the most efficient options for writing the
large attachments
> I'd really like to
> customize both input and output folders/sizes of attachments extracted
> 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, the
> 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:[email protected]]
> Enviado el: miƩrcoles, 19 de enero de 2011 13:09
> Para: [email protected]
> 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 <
> [email protected]> wrote:
>
> > Hi Sergey,
> >
> > I'm not using XOP and yes, the properties 'attachment-directory' and
> > '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:
> >
> > <jaxrs:server id="genericServer"
> > modelRef="classpath:/WEB-INF/model/GenericModel.xml" abstract="true">
> > <jaxrs:features>
> > <cxf:logging/>
> > </jaxrs:features>
> > <jaxrs:inInterceptors>
> > <ref bean="gzipInInterceptor" />
> > </jaxrs:inInterceptors>
> > <jaxrs:outInterceptors>
> > <ref bean="gzipOutInterceptor" />
> > </jaxrs:outInterceptors>
> > <jaxrs:properties>
> > <entry key="attachment-directory" value="/temp/mobility"/>
> > <!-- 400K-->
> > <entry key="attachment-memory-threshold" value="409600"/>
> > </jaxrs:properties>
> > </jaxrs:server>
> >
> >
> > <bean id="attachmentServer" parent="genericServer">
> > <property name="modelRef"
> > value="classpath:/WEB-INF/model/AttachmentModel.xml" />
> > <property name="address" value="/attachments" />
> > <property name="serviceBeans">
> > <!-- Service Bean omitted -->
> > </property>
> > </bean>
> >
> > ---------------
> > Response-Code: 200
> > Content-Type: application/octet-stream
> > Headers: {Date=[Wed, 19 Jan 2011 10:20:55 GMT], Content-Encoding=[gzip],
> > Vary=[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=someValue
> and
> -Dorg.apache.cxf.io.CachedOutputStream.OutputDirectory=/temp/mobility
>
> 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:[email protected]]
> > Enviado el: miƩrcoles, 19 de enero de 2011 12:06
> > Para: [email protected]
> > Asunto: Re: JAX-RS Attachments size limit and temp folder
> >
> > Hi
> >
> > On Wed, Jan 19, 2011 at 10:56 AM, Ivan Vitoria Sanchez <
> > [email protected]> wrote:
> >
> > > Hi everyone,
> > >
> > >
> > >
> > > I'm developing a JAX-RS server (CXF 2.3.1) which performs both GET and
> > POST
> > > operations with DataHandler attachments within a bean, and it works
> fine
> > > (I'm not sending Multiparts). However, I could not set neither the 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? If so,
> > how
> > > can i do it?
> > >
> > >
> > >
> > > Thanks in advance!
> > >
> > >
> > >
> > > Ivan
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>