2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2020,2023 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.common.endpoints.http.server;
24 import java.util.List;
25 import java.util.Properties;
28 * Factory of HTTP Servlet-Enabled Servlets.
30 public interface HttpServletServerFactory {
33 * Builds an http or https rest server with support for servlets.
36 * @param https use secured http over tls connection
37 * @param host binding host
39 * @param sniHostCheck SNI Host checking flag
40 * @param contextPath server base path
41 * @param swagger enable swagger documentation
42 * @param managed is it managed by infrastructure
44 * @throws IllegalArgumentException when invalid parameters are provided
46 HttpServletServer build(String name, boolean https, String host, int port, boolean sniHostCheck, String contextPath,
47 boolean swagger, boolean managed);
50 * Builds an http rest server with support for servlets.
53 * @param host binding host
55 * @param contextPath server base path
56 * @param swagger enable swagger documentation
57 * @param managed is it managed by infrastructure
59 * @throws IllegalArgumentException when invalid parameters are provided
61 HttpServletServer build(String name, String host, int port, String contextPath, boolean swagger, boolean managed);
64 * Build a list of http rest servers per properties.
66 * @param properties properties based configuration
67 * @return list of http servers
68 * @throws IllegalArgumentException when invalid parameters are provided
70 List<HttpServletServer> build(Properties properties);
73 * Builds an http or https server to manage static resources.
76 * @param https use secured http over tls connection
77 * @param host binding host
79 * @param sniHostCheck SNI Host checking flag
80 * @param contextPath server base path
81 * @param managed is it managed by infrastructure
83 * @throws IllegalArgumentException when invalid parameters are provided
85 HttpServletServer buildStaticResourceServer(String name, boolean https, String host, int port, boolean sniHostCheck,
86 String contextPath, boolean managed);
89 * Gets a server based on the port.
94 HttpServletServer get(int port);
97 * Provides an inventory of servers.
99 * @return inventory of servers
101 List<HttpServletServer> inventory();
104 * Destroys server bound to a port.
106 * @param port the port the server is bound to
108 void destroy(int port);
111 * Destroys the factory and therefore all servers.