View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.jersey.exception;
8   
9   import javax.ws.rs.core.Response;
10  import javax.ws.rs.ext.ExceptionMapper;
11  
12  public class HelloWorldExceptionMapper implements ExceptionMapper<HelloWorldException>
13  {
14      public Response toResponse(HelloWorldException exception)
15      {
16          int status = Response.Status.SERVICE_UNAVAILABLE.getStatusCode();
17          return Response.status(status).entity(exception.getMessage()).type("text/plain").build();
18      }
19  }