Reputation: 891
I have a RESTful web service. For implementation using JAX-RS (Jersey).
Have the following method:
public void foo (@PathParam ("name") String uuid) {
...
}
I need to do validation of input parameters. And if data invalid throw WebApplicationException.
I added my custom annotation CheckUuid (extends ):
public void foo (@PathParam ("name") @CheckUuid String uuid) {
...
}
Is it possible to do validation using annotations on a stage when the method chosen, but not yet called? For example using PreProcessInterceptor?
Upvotes: 2
Views: 1166
Reputation: 891
As a result, it was decided to use the standard pattern in the method validation. Because in Jersey do not have PreProcessInterceptor.
Upvotes: 0
Reputation: 479
Java EE6 has some built in validation functionality.
http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html
I have not used it however, but I saw it brought up during Java One and it looks pretty cool. I'm not sure at what point this would happen, but I think it might work out for you.
Upvotes: 1