01: /* Copyright 2005 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.utils.uri;
07:
08: import java.net.URI;
09:
10: /**
11: * Exceptional circumstance of a requested URI being blocked by local policy.
12: * Conveys the URI that was blocked and the reason it was blocked.
13: * @since uPortal 2.5.1
14: */
15: public class BlockedUriException extends RuntimeException {
16:
17: /**
18: * Serialized format version number. Developers must manually increment this
19: * number whenever this class is changed in such a way that its serialized form
20: * changes.
21: */
22: private static final long serialVersionUID = 1L;
23:
24: /**
25: * The URI that was blocked.
26: */
27: private final URI uri;
28:
29: /**
30: * The reason the URI was blocked.
31: */
32: private final String reasonBlocked;
33:
34: /**
35: * Create unchained exception instance.
36: * @param uriArg URI being blocked
37: * @param reasonBlockedArg reason for blocking the URI
38: */
39: public BlockedUriException(URI uriArg, String reasonBlockedArg) {
40: super ("Blocked URI [" + uriArg + "] because: "
41: + reasonBlockedArg);
42: this .uri = uriArg;
43: this .reasonBlocked = reasonBlockedArg;
44: }
45:
46: /**
47: * Create chained exception instance.
48: * @param uriArg URI being blocked
49: * @param reasonBlockedArg reason the URI was blocked.
50: * @param cause underlying cause for block.
51: */
52: public BlockedUriException(URI uriArg, String reasonBlockedArg,
53: Throwable cause) {
54: super ("Blocked URI: " + uriArg + " because: "
55: + reasonBlockedArg, cause);
56: this .uri = uriArg;
57: this .reasonBlocked = reasonBlockedArg;
58: }
59:
60: public String getReasonBlocked() {
61: return this .reasonBlocked;
62: }
63:
64: public URI getBlockedUri() {
65: return this.uri;
66: }
67:
68: }
|