View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.shiro.subject.support;
20  
21  import org.apache.shiro.session.SessionException;
22  
23  /**
24   * Exception thrown if attempting to create a new {@code Subject}
25   * {@link org.apache.shiro.subject.Subject#getSession() session}, but that {@code Subject}'s sessions are disabled.
26   * <p/>
27   * Note that this exception represents an invalid API usage scenario - where Shiro has been configured to disable
28   * sessions for a particular subject, but a developer is attempting to use that Subject's session.
29   * <p/>
30   * In other words, if this exception is encountered, it should be resolved by a configuration change for Shiro and
31   * <em>not</em> by checking every Subject to see if they are enabled or not (which would likely introduce very
32   * ugly/paranoid code checks everywhere a session is needed). This is why there is no
33   * {@code subject.isSessionEnabled()} method.
34   *
35   * @since 1.2
36   */
37  public class DisabledSessionException extends SessionException {
38  
39      public DisabledSessionException(String message) {
40          super(message);
41      }
42  }