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.MethodNotAllowed.*;
016
017import java.text.*;
018
019import org.apache.juneau.http.annotation.*;
020import org.apache.juneau.rest.*;
021
022/**
023 * Exception representing an HTTP 405 (Method Not Allowed).
024 *
025 * <p>
026 * A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
027 *
028 * @deprecated Use {@link org.apache.juneau.http.exception.MethodNotAllowed}
029 */
030@Response(code=CODE, description=MESSAGE)
031@Deprecated
032public class MethodNotAllowed extends RestException {
033   private static final long serialVersionUID = 1L;
034
035   /** HTTP status code */
036   public static final int CODE = 405;
037
038   /** Default message */
039   public static final String MESSAGE = "Method Not Allowed";
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 MethodNotAllowed(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 MethodNotAllowed(String msg) {
058      super(msg);
059      setStatus(CODE);
060   }
061
062   /**
063    * Constructor.
064    */
065   public MethodNotAllowed() {
066      this((Throwable)null, MESSAGE);
067   }
068
069   /**
070    * Constructor.
071    *
072    * @param msg The message.  Can be <jk>null</jk>.
073    * @param args Optional {@link MessageFormat}-style arguments in the message.
074    */
075   public MethodNotAllowed(String msg, Object...args) {
076      this(null, msg, args);
077   }
078
079   /**
080    * Constructor.
081    *
082    * @param cause The cause.  Can be <jk>null</jk>.
083    */
084   public MethodNotAllowed(Throwable cause) {
085      this(cause, null);
086   }
087}