]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
d331453426a3dc529ffd102eb796b551091fbc05
[tmp/jakarta-migration.git] /
1 /**
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:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
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.
23  */
24 package org.collectionspace.services.common.security;
25
26 import org.collectionspace.services.common.ServiceException;
27
28 /**
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
33  * @author 
34  */
35 public class ServiceForbiddenException extends ServiceException {
36
37     final public static int HTTP_CODE = 401;
38
39     /**
40      * Creates a new instance of <code>UnauthorizedException</code> without detail message.
41      */
42     public ServiceForbiddenException() {
43         super(HTTP_CODE);
44     }
45
46     /**
47      * Constructs an instance of <code>UnauthorizedException</code> with the specified detail message.
48      * @param msg the detail message.
49      */
50     public ServiceForbiddenException(String msg) {
51         super(msg);
52         setErrorCode(HTTP_CODE);
53     }
54
55     /**
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.
60      *
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
66      *         unknown.)
67      * @since  1.4
68      */
69     public ServiceForbiddenException(String message, Throwable cause) {
70         super(message, cause);
71         setErrorCode(HTTP_CODE);
72     }
73
74     /**
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}).
81      *
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
85      *         unknown.)
86      * @since  1.4
87      */
88     public ServiceForbiddenException(Throwable cause) {
89         super(cause);
90         setErrorCode(HTTP_CODE);
91     }
92 }