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;
014
015import static org.apache.juneau.internal.StringUtils.*;
016
017import java.text.*;
018
019import javax.servlet.*;
020
021/**
022 * General exception thrown from {@link RestServlet} during construction or initialization.
023 */
024public class RestServletException extends ServletException {
025
026   private static final long serialVersionUID = 1L;
027
028   /**
029    * Constructor.
030    *
031    * @param message The detailed message.
032    * @param args Optional {@link MessageFormat}-style arguments.
033    */
034   public RestServletException(String message, Object...args) {
035      super(format(message, args));
036   }
037
038   /**
039    * Sets the inner cause for this exception.
040    *
041    * @param cause The inner cause.
042    * @return This object (for method chaining).
043    */
044   @Override /* Throwable */
045   public synchronized RestServletException initCause(Throwable cause) {
046      super.initCause(cause);
047      return this;
048   }
049}