Line data Source code
1 : // Copyright (C) 2012 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.restapi; 16 : 17 : /** Named resource does not exist (HTTP 404 Not Found). */ 18 : public class ResourceNotFoundException extends RestApiException { 19 : private static final long serialVersionUID = 1L; 20 : 21 : /** Requested resource is not found, failing portion not specified. */ 22 7 : public ResourceNotFoundException() {} 23 : 24 : public ResourceNotFoundException(String msg) { 25 25 : super(msg); 26 25 : } 27 : 28 : public ResourceNotFoundException(String msg, Throwable cause) { 29 12 : super(msg, cause); 30 12 : } 31 : 32 : /** @param id portion of the resource URI that does not exist. */ 33 : public ResourceNotFoundException(IdString id) { 34 32 : super("Not found: " + id.get()); 35 32 : } 36 : 37 : public ResourceNotFoundException(IdString id, Throwable cause) { 38 3 : super("Not found: " + id.get(), cause); 39 3 : } 40 : 41 : public ResourceNotFoundException caching(CacheControl c) { 42 0 : setCaching(c); 43 0 : return this; 44 : } 45 : }