Java Code Examples for org.apache.nifi.util.NiFiProperties#getPort()

The following examples show how to use org.apache.nifi.util.NiFiProperties#getPort() . 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: JettyServer.java    From nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if there are configured properties for both HTTP and HTTPS connectors (specifically port because the hostname can be left blank in the HTTP connector).
 * Prints a warning log message with the relevant properties.
 *
 * @param props the NiFiProperties
 * @return true if both ports are present
 */
static boolean bothHttpAndHttpsConnectorsConfigured(NiFiProperties props) {
    Integer httpPort = props.getPort();
    String httpHostname = props.getProperty(NiFiProperties.WEB_HTTP_HOST);

    Integer httpsPort = props.getSslPort();
    String httpsHostname = props.getProperty(NiFiProperties.WEB_HTTPS_HOST);

    if (httpPort != null && httpsPort != null) {
        logger.warn("Both the HTTP and HTTPS connectors are configured in nifi.properties. Only one of these connectors should be configured. See the NiFi Admin Guide for more details");
        logger.warn("HTTP connector:   http://" + httpHostname + ":" + httpPort);
        logger.warn("HTTPS connector: https://" + httpsHostname + ":" + httpsPort);
        return true;
    }

    return false;
}
 
Example 2
Source File: HostHeaderHandler.java    From nifi with Apache License 2.0 4 votes vote down vote up
private int determineServerPort(NiFiProperties props) {
    return props.getSslPort() != null ? props.getSslPort() : props.getPort();
}