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.Gone.*;
016
017import java.text.*;
018
019import org.apache.juneau.http.annotation.*;
020import org.apache.juneau.rest.*;
021
022/**
023 * Exception representing an HTTP 410 ().
024 *
025 * <div class='warn'>
026 *    <b>Deprecated</b> - Use {@link org.apache.juneau.http.exception.Gone}
027 * </div>
028 *
029 * <p>
030 * Indicates that the resource requested is no longer available and will not be available again.
031 * <br>This should be used when a resource has been intentionally removed and the resource should be purged.
032 * <br>Upon receiving a 410 status code, the client should not request the resource in the future.
033 * <br>Clients such as search engines should remove the resource from their indices.
034 * <br>Most use cases do not require clients and search engines to purge the resource, and a <js>"404 Not Found"</js> may be used instead.
035 */
036@Response(code=CODE, description=MESSAGE)
037@Deprecated
038public class Gone extends RestException {
039   private static final long serialVersionUID = 1L;
040
041   /** HTTP status code */
042   public static final int CODE = 410;
043
044   /** Default message */
045   public static final String MESSAGE = "Gone";
046
047   /**
048    * Constructor.
049    *
050    * @param cause The cause.  Can be <jk>null</jk>.
051    * @param msg The message.  Can be <jk>null</jk>.
052    * @param args Optional {@link MessageFormat}-style arguments in the message.
053    */
054   public Gone(Throwable cause, String msg, Object...args) {
055      super(cause, CODE, msg, args);
056   }
057
058   /**
059    * Constructor.
060    *
061    * @param msg The message.  Can be <jk>null</jk>.
062    */
063   public Gone(String msg) {
064      super(msg);
065      setStatus(CODE);
066   }
067
068   /**
069    * Constructor.
070    */
071   public Gone() {
072      this((Throwable)null, MESSAGE);
073   }
074
075   /**
076    * Constructor.
077    *
078    * @param msg The message.  Can be <jk>null</jk>.
079    * @param args Optional {@link MessageFormat}-style arguments in the message.
080    */
081   public Gone(String msg, Object...args) {
082      this(null, msg, args);
083   }
084
085   /**
086    * Constructor.
087    *
088    * @param cause The cause.  Can be <jk>null</jk>.
089    */
090   public Gone(Throwable cause) {
091      this(cause, null);
092   }
093}