I am exposing a REST service in which i'm trying to return different HTTP status codes based on the type of error.
Unfortunately the only error status that I managed to send is 500.
I tried the following but it doesn't seem to work.
throw new RestException(e.getMessage(), ServletUtil.getCurrentResponse().getResponse(), 404);
Any ideas?
Thank you in advance.
For ATG 11.3 you have different types of RESTful web services:
JAX-RS
If you are using the JAX-RS web services then follow the instructions here
In addition the API Documentation states the following:
Also note, there are two RestException classes one is
atg.rest.RestExceptionand the other isatg.service.jaxrs.RestExceptionso make sure that you have imported the right one.REST MVC
If you are using REST MVC (which I am guessing your are) then follow the instructions here.