summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.server
diff options
context:
space:
mode:
authorShireesh Anjal <shireesh@gluster.com>2011-07-11 00:33:58 +0530
committerShireesh Anjal <shireesh@gluster.com>2011-07-11 00:33:58 +0530
commitefe32527e41e28b30b0393f9963daad608ec5c2c (patch)
tree0eaaf965c5dcd340d643d591e7e36b54a5d25e6c /src/com.gluster.storage.management.server
parent901d2fc3cfd69219e84de8845e7b8c2e61e35672 (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.java39
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();
+ }
+}