diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-07-11 00:33:58 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-07-11 00:33:58 +0530 |
| commit | efe32527e41e28b30b0393f9963daad608ec5c2c (patch) | |
| tree | 0eaaf965c5dcd340d643d591e7e36b54a5d25e6c /src/com.gluster.storage.management.server | |
| parent | 901d2fc3cfd69219e84de8845e7b8c2e61e35672 (diff) | |
Task#111 - Auto-refresh of data in views
Diffstat (limited to 'src/com.gluster.storage.management.server')
| -rw-r--r-- | src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/GlusterExceptionMapper.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/GlusterExceptionMapper.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/GlusterExceptionMapper.java new file mode 100644 index 00000000..99089eb7 --- /dev/null +++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/GlusterExceptionMapper.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * <http://www.gnu.org/licenses/>. + *******************************************************************************/ +package com.gluster.storage.management.server.resources.v1_0; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; + +@Provider +public class GlusterExceptionMapper implements ExceptionMapper<GlusterRuntimeException> { + + /* (non-Javadoc) + * @see javax.ws.rs.ext.ExceptionMapper#toResponse(java.lang.Throwable) + */ + @Override + public Response toResponse(GlusterRuntimeException exception) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(exception.getMessage()) + .type(MediaType.TEXT_PLAIN).build(); + } +} |
