Custom Response + HTTP status?
- by Cristian Boariu
Hi,
I have a rest interface for my project.
For one class i have a POST method where you can post an xml and i RETURN a custom response like:
<userInvitation>Invalid email</userInvitation>
if the email from the xml which was posted, was incorrect + other custom messages i have defined for different situations.
For all of these the HTTP STATUS is automatically put on 200 (OK).
Is there any way to change it?
Ps: I know that i can throw a web application like :
throw new WebApplicationException(Response.Status.BAD_REQUEST);
but in this case my custom response is no more included.
So i just want to return my custom error + 400 as http response.
Thanks in advance.