users@jersey.java.net

[Jersey] Re: About file size upload limit with Jersey

From: <tommif_at_iki.fi>
Date: Tue, 04 Mar 2014 11:56:44 +0200

Since the client's POST body is read from an InputStream that's given to
the method handling the request, you could use Guava
<http://code.google.com/p/guava-libraries/>'s ByteStreams.limit(..)
<http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/ByteStreams.html#limit%28java.io.InputStream,%20long%29>
to limit the maximum amount of bytes that can be read from the body.

Other's can chime in if there are different ways to handle file uploads,
or if Jersey has such funtionality built-it. Off-topic, but regarding
alleviating the effects of DDoS, there's CloudFlare
<https://www.cloudflare.com/> for example.


On 4.3.2014 7:03, hcy炎 wrote:
> Hi, Dear Jersey team,
>
> Recently my company is using Jersey for restful apis, and now we find
> it very useful. But now we want limit the file upload size because of
> DDos. So I want to ask about whether we can limit the file upload size
> based on the url's difference by using Jersey.
>
> Hope to hear from you!
>
> Thanks.
>