Merge "REST API to fetch Node Property"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / ResponseException.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.restconf.impl;
9
10 import javax.ws.rs.WebApplicationException;
11 import javax.ws.rs.core.MediaType;
12 import javax.ws.rs.core.Response;
13 import javax.ws.rs.core.Response.Status;
14
15 public class ResponseException extends WebApplicationException {
16
17     private static final long serialVersionUID = -5320114450593021655L;
18
19     public ResponseException(Status status, String msg) {
20         super(Response.status(status).type(MediaType.TEXT_PLAIN_TYPE).entity(msg).build());
21     }
22
23     public ResponseException(Throwable cause, String msg) {
24         super(cause, Response.status(Status.INTERNAL_SERVER_ERROR).
25                                          type(MediaType.TEXT_PLAIN_TYPE).entity(msg).build());
26     }
27 }