History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: RESTEASY-24
Type: Bug Bug
Status: Closed Closed
Resolution: Done
Priority: Major Major
Assignee: Bill Burke
Reporter: Bill Burke
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Resteasy

WebApplicationException and http status codes

Created: 07/Apr/08 02:32 PM   Updated: 07/Apr/08 02:58 PM
Component/s: jaxrs
Affects Version/s: Beta1
Fix Version/s: Beta2

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Hello,

A couple of days ago I ran into a problem with throwing WebApplication examples with a response object:

throw new WebApplicationException(Response.status(412)
                                                       .type("text/plain;charset=utf-8")
                                                       .entity("Something went wrong").build());

Throwing this exception would give a text/plain body with the entity body but with http code 200. Throwing the same exception without an entity would give the expected (412 response with an empty body).

After a little code browsing I found the problem in Dispatcher.java invoke method. I created a patch file from revision 133 attached to this email.

Regards,

Thomas Cremers




Index: Dispatcher.java
===================================================================
--- Dispatcher.java (revision 135)
+++ Dispatcher.java (working copy)
@@ -136,6 +136,7 @@
 
          if (jaxrsResponse.getEntity() != null)
          {
+ response.setStatus(jaxrsResponse.getStatus());
             MediaType responseContentType = resolveContentType(invoker, in, jaxrsResponse);
             writeResponse(response, invoker, jaxrsResponse.getEntity(), responseContentType);
          }




 All   Comments   Work Log   Change History   Subversion Commits      Sort Order:
There are no comments yet on this issue.