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