2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 package org.collectionspace.services.common.security;
26 import org.collectionspace.services.common.ServiceException;
29 * ServiceForbidenException is thrown when access to service is not allowed for
30 * one or more of the following reasons:
31 * - access not allowed
32 * - no application key found
35 public class ServiceForbiddenException extends ServiceException {
37 final public static int HTTP_CODE = 401;
40 * Creates a new instance of <code>UnauthorizedException</code> without detail message.
42 public ServiceForbiddenException() {
47 * Constructs an instance of <code>UnauthorizedException</code> with the specified detail message.
48 * @param msg the detail message.
50 public ServiceForbiddenException(String msg) {
52 setErrorCode(HTTP_CODE);
56 * Constructs a new exception with the specified detail message and
57 * cause. <p>Note that the detail message associated with
58 * <code>cause</code> is <i>not</i> automatically incorporated in
59 * this exception's detail message.
61 * @param message the detail message (which is saved for later retrieval
62 * by the {@link #getMessage()} method).
63 * @param cause the cause (which is saved for later retrieval by the
64 * {@link #getCause()} method). (A <tt>null</tt> value is
65 * permitted, and indicates that the cause is nonexistent or
69 public ServiceForbiddenException(String message, Throwable cause) {
70 super(message, cause);
71 setErrorCode(HTTP_CODE);
75 * Constructs a new exception with the specified cause and a detail
76 * message of <tt>(cause==null ? null : cause.toString())</tt> (which
77 * typically contains the class and detail message of <tt>cause</tt>).
78 * This constructor is useful for exceptions that are little more than
79 * wrappers for other throwables (for example, {@link
80 * java.security.PrivilegedActionException}).
82 * @param cause the cause (which is saved for later retrieval by the
83 * {@link #getCause()} method). (A <tt>null</tt> value is
84 * permitted, and indicates that the cause is nonexistent or
88 public ServiceForbiddenException(Throwable cause) {
90 setErrorCode(HTTP_CODE);