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 to the submitter to debug JSON queries.

My question is, is there a way to plug into the JSON ObjectMapper
functionality that is automatically invoked in method 1 and catch the
errors?

Thanks,
Dan


On Mon, Apr 29, 2013 at 11:34 PM, Jon Sawyer <j...@jsawyer.net> wrote:

> 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 you looking for an out-of-band solution for many such handlers? If
> the latter, you probably could implement your own derivation of Restlet
> Filter does the above check, and plumb your Filter derivative upstream from
> your Resource.
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3054621
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3054657

Reply via email to