how to send JSON data with server error response code 500
- by kapil.israni
I wanted to know if theres a way to send a JSON data along with HTTP response code 500. Basically I want my rest client to know that there is some error on the backend and along with it send a JSON error data structure like this.
{"error" : [
{"code": "1001", "desc": "Some error description"},
{"code": "1002", "desc": "Some other error description"}
]
}
This is using the following java stack = Java 6/JAX-RS/Jersey/Tomcat
If not, then is there a way to send a custom response code along with JSON data. Basically looking from JAX-RS API it looks that you can only send JSON data along with 200 OK??
Any thoughts?? I am guessing RESTEasy would be the same, right??