001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.rest.exception; 014 015import static org.apache.juneau.rest.exception.UnsupportedMediaType.*; 016 017import java.text.*; 018 019import org.apache.juneau.http.annotation.*; 020import org.apache.juneau.rest.*; 021 022/** 023 * Exception representing an HTTP 415 (Unsupported Media Type). 024 * 025 * <p> 026 * The request entity has a media type which the server or resource does not support. 027 * <br>For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format. 028 * 029 * @deprecated Use {@link org.apache.juneau.http.exception.UnsupportedMediaType} 030 */ 031@Response(code=CODE, description=MESSAGE) 032@Deprecated 033public class UnsupportedMediaType extends RestException { 034 private static final long serialVersionUID = 1L; 035 036 /** HTTP status code */ 037 public static final int CODE = 415; 038 039 /** Default message */ 040 public static final String MESSAGE = "Unsupported Media Type"; 041 042 /** 043 * Constructor. 044 * 045 * @param cause The cause. Can be <jk>null</jk>. 046 * @param msg The message. Can be <jk>null</jk>. 047 * @param args Optional {@link MessageFormat}-style arguments in the message. 048 */ 049 public UnsupportedMediaType(Throwable cause, String msg, Object...args) { 050 super(cause, CODE, msg, args); 051 } 052 053 /** 054 * Constructor. 055 * 056 * @param msg The message. Can be <jk>null</jk>. 057 */ 058 public UnsupportedMediaType(String msg) { 059 super(msg); 060 setStatus(CODE); 061 } 062 063 /** 064 * Constructor. 065 */ 066 public UnsupportedMediaType() { 067 this((Throwable)null, MESSAGE); 068 } 069 070 /** 071 * Constructor. 072 * 073 * @param msg The message. Can be <jk>null</jk>. 074 * @param args Optional {@link MessageFormat}-style arguments in the message. 075 */ 076 public UnsupportedMediaType(String msg, Object...args) { 077 this(null, msg, args); 078 } 079 080 /** 081 * Constructor. 082 * 083 * @param cause The cause. Can be <jk>null</jk>. 084 */ 085 public UnsupportedMediaType(Throwable cause) { 086 this(cause, null); 087 } 088}