8

How can I limit the size of JSON POST-ed to my servlet? The below code doesn't work.

ServletContextHandler root = new ServletContextHandler(server, "/");
root.setMaxFormContentSize(10);

The server continues to accept JSON POST body larger than 10 bytes after setting this.

Chandra Sekar
  • 10,683
  • 3
  • 39
  • 54
  • 'The problem with maxFormContentSize it only limit the request size for "form" data and not for other content types like text/xml or text/json (WebService) and also only if Content-Length if send. So not really an strong security improvement.' taken from a comment on https://stackoverflow.com/questions/26181892/configure-max-post-size-for-a-external-webapp-in-jetty – Stephan Jun 12 '18 at 20:18

0 Answers0