You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hans Lesmeister <ha...@lessy-software.de> on 2015/01/28 16:58:46 UTC

Wicketstuff Restannotations AbortWithHttpErrorCodeException always results in 500 Internal Server Error

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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


AW: Wicketstuff Restannotations AbortWithHttpErrorCodeException always results in 500 Internal Server Error

Posted by Hans Lesmeister <ha...@lessy-software.de>.
Hi Warren,

life can be so easy sometimes. Thanks :-)

-- Cheers, Hans


-----Ursprüngliche Nachricht-----
Von: Warren Bell [mailto:warrenbell2@gmail.com] 
Gesendet: Donnerstag, 29. Januar 2015 05:53
An: users@wicket.apache.org
Betreff: Re: Wicketstuff Restannotations AbortWithHttpErrorCodeException always results in 500 Internal Server Error

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 <ha...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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



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


Re: Wicketstuff Restannotations AbortWithHttpErrorCodeException always results in 500 Internal Server Error

Posted by Warren Bell <wa...@gmail.com>.
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 <ha...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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