I have an interface for my project. For one class, I have a POST method where you can send xml and I RETURN a custom answer , for example:
<customResponse>Invalid email</customResponse>
if the xml email that was posted was incorrect + other custom posts that I defined for different situations.
For all of these conditions, HTTP STATUS is automatically set to 200 (OK). Is there any way to change it?
Ps: I know that I can drop a web application like:
throw new WebApplicationException(Response.Status.BAD_REQUEST);
but in this case my user response is no longer included.
So, I just want to return my custom + 400 error as a response to http.
Thanks in advance.
UPDATE after comments: My method:
@POST
@Path("{membershipExternalId}")
@Consumes(MediaType.APPLICATION_XML)
@Produces("application/xml")
public CustomResponse invite(){
, . RESPONSE, STATUS, .