So, I may be missing the obvious, but if the method's precondition is that it
receives an int[], shouldn't you be doing input validation anyway?
if (userData instanceof int[] ((int[]) userData.length 0) {
return userData;
}
else {
getResponse().setStatus(Status.BAD_REQUEST);
}
Or are
Hi Jon,
In method 1, there is a need for input validation, as you say... but when
there is input provided and there are parse errors, the handler simply gets
a *null* argument and is not able to catch the exception.
In method 2, the exception describes the parse error---which I want to feed
back
Hi,
I have a resource that takes a POST request with JSON payload. Let's say it
takes an *int[]*, and for our purposes simply returns it. There are (at
least) two ways to do this:
(1) Accept an *int[]*, letting Jackson auto-deserialize it. For echoing,
return the deserialized array.
@POST
3 matches
Mail list logo