Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] Limiting request size

Thanks Jan.

Content-Length header can be spoofed, so I think I will need to be
counting bytes. I was thinking of doing it in the MessageBodyReader
where the request InputStream is consumed. But ReaderInterceptor
sounds cleaner.

How would I implement it without having to read the InputStream twice
though? In the ReaderInterceptor and then again in the
MessageBodyReader?

On Mon, Dec 28, 2020 at 12:36 AM Jan Supol <jan.supol@xxxxxxxxxx> wrote:
>
> Hi,
>
> No, Jersey does not specify a size limit on the server side for the
> input stream. The JAX-RS way is probably to specify ReaderInterceptor
> for this.
>
> -- Jan
>
> On 27.12.2020 23:57, Martynas Jusevičius wrote:
> > Hi,
> >
> > Is there a Jersey-specific way to specify a size limit when reading
> > request InputStream? For any content type, not just
> > multipart/form-data
> >
> > Or should I just go with the general SO suggestions such as a custom
> > counting InputStream subclass:
> > https://urldefense.com/v3/__https://stackoverflow.com/questions/15445504/copy-inputstream-abort-operation-if-size-exceeds-limit/30072143*30072143__;Iw!!GqivPVa7Brio!INptU6iAaHdzm5Z01fY0FX6OEkCjetrZahY7JngKUiWIIM2EyY96fRdL2VuxnhJI$
> >
> > I am using Tomcat and I know there's a maxPostSize setting but no, it
> > doesn't do this:
> > https://urldefense.com/v3/__https://www.mail-archive.com/search?l=users@xxxxxxxxxxxxxxxxx&q=subject:*22How*to*upload*Files*larger*than*2GB*22&o=newest&f=1__;JSsrKysrKyU!!GqivPVa7Brio!INptU6iAaHdzm5Z01fY0FX6OEkCjetrZahY7JngKUiWIIM2EyY96fRdL2UOpH8zd$
> >
> >
> > Martynas
> > _______________________________________________
> > jersey-dev mailing list
> > jersey-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/jersey-dev__;!!GqivPVa7Brio!INptU6iAaHdzm5Z01fY0FX6OEkCjetrZahY7JngKUiWIIM2EyY96fRdL2TYch7zN$
> _______________________________________________
> jersey-dev mailing list
> jersey-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jersey-dev


Back to the top