7373f0c48d79e36de66f1553d26f96dc92ab8608
[netconf.git] / transport / transport-http / src / main / java / org / opendaylight / netconf / transport / http / RequestDispatcher.java
1 /*
2  * Copyright (c) 2024 PANTHEON.tech s.r.o. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.transport.http;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import io.netty.handler.codec.http.FullHttpRequest;
12 import io.netty.handler.codec.http.FullHttpResponse;
13
14 /**
15  * Functional interface for HTTP request dispatcher.
16  */
17 @FunctionalInterface
18 public interface RequestDispatcher {
19
20     /**
21      * Performs {@link FullHttpRequest} processing. Any error occurred is expected either to be returned within
22      * {@link FullHttpResponse} with appropriate HTTP status code or set as future cause.
23      *
24      * @param request http request
25      * @return future providing http response or cause in case of error.
26      */
27     ListenableFuture<FullHttpResponse> dispatch(FullHttpRequest request);
28 }