Reputation: 12367
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?
Upvotes: 1
Views: 1095
Reputation: 3848
Typically you would use a filter. Here's an example in Grails, and one in Ruby. Here's a tutorial that would show how to do this in Jersey.
Upvotes: 1
Reputation: 6061
Usually, you can configure maximum size of post request on ServletContainer. For example, Tomcat has maxPostSize
setting in httpConnector directive. By default it's 2 mb or so in Tomcat.
Upvotes: 2