users@jersey.java.net

[Jersey] Re: limit on byte[] or InputStream parameters

From: Glen Mazza <gmazza_at_talend.com>
Date: Sun, 26 Feb 2012 12:13:46 -0500

You might try to configure a filter (unrelated example would be [1]) at
the servlet container level that would automatically throw some system
exception if the size of the incoming message goes above a particular
threshold. I.e., have your servlet container, and not Jersey itself,
enforce this.

Glen

[1]
https://github.com/gmazza/jersey-samples-on-cxf/blob/master/https-clientserver-grizzly/src/main/java/com/sun/jersey/samples/https_grizzly/auth/SecurityFilter.java

On 02/26/2012 08:15 AM, Ronak Patel wrote:
> Hi all,
>
> I know that Jersey can handle byte[] and InputStream parameters and
> it's been working great.
>
> However, I was wondering how Jersey would let me place a limit on the
> size of said byte[] or InputStream.
>
> It's a serious security risk when a client can upload a 4 GB file and
> crash the JVM!!
>
> Thanks!
>
> Ronak Patel


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza