Hans,

I handle all exceptions and set status codes in my mapped method with 
AbstractRestResource#setResponseStatusCode(…). I don’t ever throw any 
exceptions from there. Setting a status code is the only thing that is really 
happening in AbstractRestResource#invokeMappedMethod(…) when an exception is 
caught anyway. Just spare the throwing of an exception and set the status code 
in your mapped method.

throw new AbortWithHttpErrorCodeException(“500”, “Ouch”);

versus

setResponseStatusCode(“500”); 

Also, I believe AbortWithHttpErrorCodeException is part of Wicket core, not 
something meant to be used in rest-annotations.

Hope this helps,

Warren Bell

> On Jan 28, 2015, at 7:58 AM, Hans Lesmeister 
> <hans.lesmeis...@lessy-software.de> wrote:
> 
> Hi,
> 
> We use the great rest-annotation from wicketstuff.
> One thing that bothers is if the AbortWithHttpErrorCodeException with a
> specific code (404, 402, etc) is thrown by the mapped method, those error
> codes do not make it to the calling client. The client always seems to get a
> 500.
> 
> I debugged through the request/response and found this in
> AbstractRestResource:
> http://pastebin.com/NKNmNHv6
> 
> Is there any way of getting the correct error codes to the client? If not,
> how are other people handling this?
> I would be glad to invest some time and apply a patch if necessary
> 
> -- Thanks and Cheers, Hans
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to