blob: b46751d5a3cce393c61461f4a50ced249d4ba844 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.handler;
import com.yahoo.jdisc.Request;
import com.yahoo.jdisc.service.ClientProvider;
import java.net.URI;
/**
* <p>This exception is used to signal that a {@link Request} was rejected by the corresponding {@link ClientProvider}
* or {@link RequestHandler}. There is no automation in throwing an instance of this class, but all RequestHandlers are
* encouraged to use this where appropriate.</p>
*
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
*/
public final class RequestDeniedException extends RuntimeException {
private final Request request;
/**
* <p>Constructs a new instance of this class with a detail message that contains the {@link URI} of the {@link
* Request} that was denied.</p>
*
* @param request The Request that was denied.
*/
public RequestDeniedException(Request request) {
super("Request with URI '" + request.getUri() + "' denied.");
this.request = request;
}
/**
* <p>Returns the {@link Request} that was denied.</p>
*
* @return The Request that was denied.
*/
public Request request() {
return request;
}
}
|