You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2012/03/02 14:34:10 UTC

Re: Is it possible to prevent the whole content to be uploaded if content length is too large ?

Contextual properties for non-root parts will also be supported now 
start from 2.5.3 for jaxws/jaxrs. Though an 'attachment-directory' seems 
to be of more interest for individual endpoints.

I guess we can also consider introducing part specific properties, ex,
attachment.max-size.part2 = 1000,
where 'part2' is Content-ID or Content-Disposition/name of one of the 
parts, which will let us control multiparts in a very fine-grained way...

Sergey


On 29/02/12 16:15, Sergey Beryozkin wrote:
> The following test works in JAXRSMultipartTest in systest/jaxrs:
>
> POST /bookstore/books/image HTTP/1.1
> Content-Type: multipart/mixed
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: 127.0.0.1:8081
> Content-Length: 2287
>
> --g9ilY2cyv-BWnEJdQlNNX-mSdheEbMTSIySU_
> Content-Disposition: form-data; name="image"; filename="testfile.png"
> Content-Type: image/png; charset=ISO-8859-1
> Content-Transfer-Encoding: binary
>
> some binary content
>
> --g9ilY2cyv-BWnEJdQlNNX-mSdheEbMTSIySU_--
>
> and response:
>
> HTTP/1.1 413 Request Entity Too Large
> Date: Wed, 29 Feb 2012 16:09:14 GMT
> Content-Length: 0
> Server: Jetty(7.5.4.v20111024)
>
>
> I think the reason it does not work in your case is that
> the contextual properties are only applicable to the root part, which is
> a simple soap envelope in your case.
>
> Try a system property "org.apache.cxf.io.CachedOutputStream.MaxSize"
> instead - definitely should work.
> Alternatively try the patch available at:
> https://issues.apache.org/jira/browse/CXF-4142
>
> I think now it is actually safe to apply as the patch will be really
> applicable for non-root parts only.
>
> Cheers, Sergey
>
> On 29/02/12 11:59, mkserkan wrote:
>> Unfortunately, does not work.
>>
>> CXF version : *2.5.1*
>>
>> spring conf relating properties :
>>
>> *<jaxws:properties>
>> <entry key="schema-validation-enabled" value="false" />
>> <entry key="attachment-max-size" value="1000" />
>> <entry key="mtom-enabled" value="true" />
>> </jaxws:properties>*
>>
>> http raw request (SOAP UI):
>>
>> *POST http://................ HTTP/1.1
>> Accept-Encoding: gzip,deflate
>> SOAPAction: "............."
>> Content-Type: multipart/related; type="application/xop+xml";
>> start="<ro...@soapui.org>"; start-info="text/xml";
>> boundary="----=_Part_98_4789609.1330516166058"
>> MIME-Version: 1.0
>> User-Agent: Jakarta Commons-HttpClient/3.1
>> Host: localhost:8050
>> Content-Length: 25830182
>>
>>
>> ------=_Part_98_4789609.1330516166058
>> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
>> Content-Transfer-Encoding: 8bit
>> Content-ID:<ro...@soapui.org>
>>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>> <soapenv:Header/>
>> <soapenv:Body>
>> .
>> .
>> .
>> .
>> .
>> </soapenv:Body>
>> </soapenv:Envelope>
>> ------=_Part_98_4789609.1330516166058
>> Content-Type: application/octet-stream
>> Content-Transfer-Encoding: binary
>> Content-ID:<xxxxx>
>>
>> .
>> .
>> .
>> .
>> .
>> .
>> .
>> .
>> *
>>
>>
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/Is-it-possible-to-prevent-the-whole-content-to-be-uploaded-if-content-length-is-too-large-tp5522251p5524765.html
>>
>> Sent from the cxf-user mailing list archive at Nabble.com.
>
>