I'm trying to resolve parameters on my own.
public class NewHandler implements HandlerMethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(Param.class);
}
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
// throw Exceptions here ?
return null;
}
}
I can easily get input parameters from NativeWebRequest and dispatch them into corresponding customized @Param annotated params.
The problem is I also want to do some syntax check/validation in this area. But if I throw a Exception in 'resolveArgument', the full stack trace will be shown to users. That will be too excessive and unsafe. I simply want to return a JSON formatted message to users to show which input parameter syntax has errors.