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.BadRequest.*;
016
017import java.text.*;
018
019import org.apache.juneau.http.annotation.*;
020import org.apache.juneau.rest.*;
021
022/**
023 * Exception representing an HTTP 400 (Bad Request).
024 *
025 * <div class='warn'>
026 *    <b>Deprecated</b> - Use {@link org.apache.juneau.http.exception.BadRequest}
027 * </div>
028 *
029 * <p>
030 * The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing).
031 */
032@Response(code=CODE, description=MESSAGE)
033@Deprecated
034public class BadRequest extends RestException {
035   private static final long serialVersionUID = 1L;
036
037   /** HTTP status code */
038   public static final int CODE = 400;
039
040   /** Default message */
041   public static final String MESSAGE = "Bad Request";
042
043   /**
044    * Constructor.
045    *
046    * @param cause The cause.  Can be <jk>null</jk>.
047    * @param msg The message.  Can be <jk>null</jk>.
048    * @param args Optional {@link MessageFormat}-style arguments in the message.
049    */
050   public BadRequest(Throwable cause, String msg, Object...args) {
051      super(cause, CODE, msg, args);
052   }
053
054   /**
055    * Constructor.
056    *
057    * @param msg The message.  Can be <jk>null</jk>.
058    */
059   public BadRequest(String msg) {
060      super(msg);
061      setStatus(CODE);
062   }
063
064   /**
065    * Constructor.
066    */
067   public BadRequest() {
068      this((Throwable)null, MESSAGE);
069   }
070
071   /**
072    * Constructor.
073    *
074    * @param msg The message.  Can be <jk>null</jk>.
075    * @param args Optional {@link MessageFormat}-style arguments in the message.
076    */
077   public BadRequest(String msg, Object...args) {
078      this(null, msg, args);
079   }
080
081   /**
082    * Constructor.
083    *
084    * @param cause The cause.  Can be <jk>null</jk>.
085    */
086   public BadRequest(Throwable cause) {
087      this(cause, null);
088   }
089}