I have a JAX-RS 1.1 resource FooBar that has a method which accepts a String POST parameter as follows
@Path("/foobar")
public class FooBar {
@POST
public void doSomething(@FormParam("name") String name) {
//...
}
}
Is it possible to protect this from being called if name is longer than a specified maximum? I wonder what it does if the name is of size 1GB?
Usually, you can configure maximum size of post request on ServletContainer. For example, Tomcat has
maxPostSizesetting in httpConnector directive. By default it’s 2 mb or so in Tomcat.