com.yahoo.jdisc.handler.RequestDeniedException Maven / Gradle / Ivy
// Copyright Vespa.ai. 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;
/**
* 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.
*
* @author Simon Thoresen Hult
*/
public final class RequestDeniedException extends RuntimeException {
private final Request request;
/**
* Constructs a new instance of this class with a detail message that contains the {@link URI} of the {@link
* Request} that was denied.
*
* @param request The Request that was denied.
*/
public RequestDeniedException(Request request) {
super("Request with URI '" + request.getUri() + "' denied.");
this.request = request;
}
/**
* Returns the {@link Request} that was denied.
*
* @return The Request that was denied.
*/
public Request request() {
return request;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy