View Javadoc

1   package com.atlassian.plugins.rest.common.error.jersey;
2   
3   import com.atlassian.plugins.rest.common.Status;
4   import com.sun.jersey.api.NotFoundException;
5   
6   import javax.ws.rs.core.Response;
7   import javax.ws.rs.ext.ExceptionMapper;
8   
9   /**
10   * A generic exception mapper that will map {@link NotFoundException not found exceptions}.
11   * @since 1.0
12   */
13  public class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException>
14  {
15      public Response toResponse(NotFoundException exception)
16      {
17          return Status.notFound().message(exception.getMessage()).response();
18      }
19  }