Java Code Examples for org.apache.catalina.connector.Connector#getLocalPort()
The following examples show how to use
org.apache.catalina.connector.Connector#getLocalPort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TomcatWebServer.java From spring-graalvm-native with Apache License 2.0 | 5 votes |
private String getPortsDescription(boolean localPort) { StringBuilder ports = new StringBuilder(); for (Connector connector : this.tomcat.getService().findConnectors()) { if (ports.length() != 0) { ports.append(' '); } int port = localPort ? connector.getLocalPort() : connector.getPort(); ports.append(port).append(" (").append(connector.getScheme()).append(')'); } return ports.toString(); }
Example 2
Source File: TomcatWebServer.java From spring-graalvm-native with Apache License 2.0 | 5 votes |
public int getPort() { Connector connector = this.tomcat.getConnector(); if (connector != null) { return connector.getLocalPort(); } return 0; }
Example 3
Source File: SpringBootWebTwoConnectorsApplicationTests.java From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
@Override public void onApplicationEvent(WebServerInitializedEvent event) { Service service = ((TomcatWebServer) event.getWebServer()).getTomcat().getService(); for (Connector connector : service.findConnectors()) { if (connector.getSecure()) { this.httpsPort = connector.getLocalPort(); } else { this.httpPort = connector.getLocalPort(); } } }
Example 4
Source File: ArkTomcatWebServer.java From sofa-ark with Apache License 2.0 | 5 votes |
private String getPortsDescription(boolean localPort) { StringBuilder ports = new StringBuilder(); for (Connector connector : this.tomcat.getService().findConnectors()) { if (ports.length() != 0) { ports.append(' '); } int port = localPort ? connector.getLocalPort() : connector.getPort(); ports.append(port).append(" (").append(connector.getScheme()).append(')'); } return ports.toString(); }
Example 5
Source File: ArkTomcatWebServer.java From sofa-ark with Apache License 2.0 | 5 votes |
@Override public int getPort() { Connector connector = this.tomcat.getConnector(); if (connector != null) { return connector.getLocalPort(); } return 0; }
Example 6
Source File: TomcatServerFactory.java From api-layer with Eclipse Public License 2.0 | 5 votes |
static int getLocalPort(Tomcat tomcat) { Service[] services = tomcat.getServer().findServices(); for (Service service : services) { for (Connector connector : service.findConnectors()) { ProtocolHandler protocolHandler = connector.getProtocolHandler(); if (protocolHandler instanceof Http11AprProtocol || protocolHandler instanceof Http11NioProtocol) { return connector.getLocalPort(); } } } return 0; }