blob: 3ba3f810bad0dfd4c47bee3ed8b26ab2b5fe2480 (
plain)
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
|
package org.onap.sdc.workflow.server.config;
import org.eclipse.jetty.server.ServerConnector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.jetty.JettyServerCustomizer;
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;
@Configuration
public class WebServerConfig implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
@Value("${http.port}")
private int httpPort;
@Override
public void customize(ConfigurableServletWebServerFactory container) {
if (container instanceof JettyServletWebServerFactory) {
JettyServletWebServerFactory containerFactory = (JettyServletWebServerFactory) container;
containerFactory.addServerCustomizers((JettyServerCustomizer) server -> {
ServerConnector connector = new ServerConnector(server);
connector.setPort(httpPort);
server.addConnector(connector);
});
}
}
}
|