0
아래에 다른 방법 외에 쿼리 매개 변수 값의 유효성을 검사하는 방법이 있습니까? 즉, wadl을 통해 스키마에 매핑하여 저지 방법이 있습니까? 고맙습니다.queryparam 값 저지의 유효성 검사
@Path("smooth")
@GET
public Response smooth(
@DefaultValue("blue") @QueryParam("min-color") ColorParam minColor,
public class ColorParam extends Color {
public ColorParam(String s) {
super(getRGB(s));
}
private static int getRGB(String s) {
if (s.charAt(0) == '#') {
try {
Color c = Color.decode("0x" + s.substring(1));
return c.getRGB();
} catch (NumberFormatException e) {
throw new WebApplicationException(400);