X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fcommons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fcommons%2Fexception%2FUnsupportedMediaTypeException.java;fp=opendaylight%2Fnorthbound%2Fcommons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fcommons%2Fexception%2FUnsupportedMediaTypeException.java;h=c54d2cf203fd0b2cd061b2bb9a520c450a4255ab;hb=29f7cfb54b580928c7feac63abce028a7014b0d5;hp=0000000000000000000000000000000000000000;hpb=42210c03b0a4c54706320ba9f55794c0abd4d201;p=controller.git diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/UnsupportedMediaTypeException.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/UnsupportedMediaTypeException.java new file mode 100644 index 0000000000..c54d2cf203 --- /dev/null +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/exception/UnsupportedMediaTypeException.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.northbound.commons.exception; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; + +/** + * Status Code 415 (Unsupported Media Type) + * + * The server is refusing to service the request because the entity of + * the request is in a format not supported by the requested resource + * for the requested method. + * + * + * + */ +public class UnsupportedMediaTypeException extends WebApplicationException { + private static final long serialVersionUID = 1L; + + public UnsupportedMediaTypeException(String string) { + super(Response.status(Response.Status.UNSUPPORTED_MEDIA_TYPE).entity( + string).type(MediaType.TEXT_PLAIN).build()); + } +}