When I started implementing validation in Resteasy, I couldn't make
sense of how groups should be used. Then I found that Leandro Ferro
Luzia, who implemented the original version of validation in Resteasy,
had a very nice example:
@Path("shouldRespectGroups")
@Consumes(MediaType.WILDCARD)
@ValidateRequest
public static interface ShouldRespectGroups {
@POST
@Path("insert")
@ValidateRequest(groups = InsertPhase.class)
public String insert(@Form InputBean input);
@POST
@Path("sum")
@ValidateRequest(groups = UpdatePhase.class)
public String update(@Form InputBean input);
...
}
The @ValidateRequest annotation can be used to turn on validation for
some or all groups. There is also @DoNotValidateRequest, which can be
used to turn off validation.
The usage is explained here:
http://docs.jboss.org/resteasy/docs/2.3.1.GA/userguide/html/Validation.html
-Ron
--
Erdös number 4.