cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Is it possible to prevent the whole content to be uploaded if content length is too large ?
Date Tue, 28 Feb 2012 16:55:22 GMT
On 28/02/12 15:56, mkserkan wrote:
> Here is sample interceptor snippet code :
>
> *	public void handleMessage(Message message) throws Fault {		
> 		Map<String, List&lt;String>>  headers = (Map<String, List&lt;String>>)
> message.get(Message.PROTOCOL_HEADERS);
> 		List<String>  clHeader = headers.get("Content-Length");
> 		int contentLength = 0;
> 		if (clHeader != null&&  clHeader.size()>  0 )
> 			contentLength = new Integer(clHeader.get(0)) ;
> 		
> 		if (contentLength>  5000) {
> 			throw new Fault(new RuntimeException("TOO LARGE CONTENT"));
> 		}
> 	}*
>
> But it doesn't work ? Still all contents are uploaded to server. Is it
> possible via another mechanism like setting jaxws properties ?
>

Set the contextual property "attachment-max-size" to some value (in 
bytes) and you should get HTTP 413 back, possibly 500 in case of JAX-WS

HTH, Sergey

> --
> 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-tp5522251p5522251.html
> Sent from the cxf-user mailing list archive at Nabble.com.



Mime
View raw message