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