0
除了下面的方法之外,是否還有其他任何方式來驗證查詢參數值,即是否有通過映射到wadl的模式的Jersey方法。謝謝驗證查詢參數值球衣
@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);