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.Locked.*; 016 017import java.text.*; 018 019import org.apache.juneau.http.annotation.*; 020 021/** 022 * Exception representing an HTTP 423 (Locked). 023 * 024 * <p> 025 * The resource that is being accessed is locked. 026 */ 027@Response(code=CODE, description=MESSAGE) 028public class Locked extends HttpException { 029 private static final long serialVersionUID = 1L; 030 031 /** HTTP status code */ 032 public static final int CODE = 423; 033 034 /** Default message */ 035 public static final String MESSAGE = "Locked"; 036 037 /** 038 * Constructor. 039 * 040 * @param cause The cause. Can be <jk>null</jk>. 041 * @param msg The message. Can be <jk>null</jk>. 042 * @param args Optional {@link MessageFormat}-style arguments in the message. 043 */ 044 public Locked(Throwable cause, String msg, Object...args) { 045 super(cause, CODE, msg, args); 046 } 047 048 /** 049 * Constructor. 050 * 051 * @param msg The message. Can be <jk>null</jk>. 052 */ 053 public Locked(String msg) { 054 this((Throwable)null, msg); 055 } 056 057 /** 058 * Constructor. 059 */ 060 public Locked() { 061 this((Throwable)null, MESSAGE); 062 } 063 064 /** 065 * Constructor. 066 * 067 * @param msg The message. Can be <jk>null</jk>. 068 * @param args Optional {@link MessageFormat}-style arguments in the message. 069 */ 070 public Locked(String msg, Object...args) { 071 this(null, msg, args); 072 } 073 074 /** 075 * Constructor. 076 * 077 * @param cause The cause. Can be <jk>null</jk>. 078 */ 079 public Locked(Throwable cause) { 080 this(cause, null); 081 } 082 083 //------------------------------------------------------------------------------------------------------------------ 084 // Fluent setters. 085 //------------------------------------------------------------------------------------------------------------------ 086 087 // <FluentSetters> 088 089 @Override /* GENERATED - HttpException */ 090 public Locked header(String name, Object val) { 091 super.header(name, val); 092 return this; 093 } 094 095 // </FluentSetters> 096}