Refactor transport-http response delivery
[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.FutureCallback;
11 import io.netty.handler.codec.http.FullHttpRequest;
12 import io.netty.handler.codec.http.FullHttpResponse;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14
15 /**
16  * Functional interface for HTTP request dispatcher.
17  */
18 @NonNullByDefault
19 @FunctionalInterface
20 public interface RequestDispatcher {
21     /**
22      * Performs {@link FullHttpRequest} processing. Any error occurred is expected either to be returned within
23      * {@link FullHttpResponse} with appropriate HTTP status code or set as future cause. Note that
24      *
25      * @param request HTTP request
26      * @param callback invoked when the request completes
27      */
28     void dispatch(FullHttpRequest request, FutureCallback<FullHttpResponse> callback);
29 }