public static HaServiceConfig createServiceConfig()

in gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HaDescriptorFactory.java [51:101]


  public static HaServiceConfig createServiceConfig(String serviceName, String enabledValue,
      String maxFailoverAttemptsValue, String failoverSleepValue,
      String zookeeperEnsemble, String zookeeperNamespace,
      String loadBalancingEnabledValue, String stickySessionsEnabledValue,
      String stickySessionCookieNameValue, String noFallbackEnabledValue,
      String disableLoadBalancingForUserAgentsValue, String failoverNonIdempotentRequestEnabledValue) {

    boolean enabled = DEFAULT_ENABLED;
    int maxFailoverAttempts = DEFAULT_MAX_FAILOVER_ATTEMPTS;
    int failoverSleep = DEFAULT_FAILOVER_SLEEP;
    boolean stickySessionsEnabled = DEFAULT_STICKY_SESSIONS_ENABLED;
    boolean loadBalancingEnabled = DEFAULT_LOAD_BALANCING_ENABLED;
    boolean noFallbackEnabled = DEFAULT_NO_FALLBACK_ENABLED;
    String stickySessionCookieName = DEFAULT_STICKY_SESSION_COOKIE_NAME;
    String disableLoadBalancingForUserAgentsConfig = DEFAULT_DISABLE_LB_USER_AGENTS;
    boolean failoverNonIdempotentRequestEnabled = DEFAULT_FAILOVER_NON_IDEMPOTENT;

    if (enabledValue != null && !enabledValue.trim().isEmpty()) {
      enabled = Boolean.parseBoolean(enabledValue);
    }
    if (maxFailoverAttemptsValue != null && !maxFailoverAttemptsValue.trim().isEmpty()) {
      maxFailoverAttempts = Integer.parseInt(maxFailoverAttemptsValue);
    }
    if (failoverSleepValue != null && !failoverSleepValue.trim().isEmpty()) {
      failoverSleep = Integer.parseInt(failoverSleepValue);
    }
    if (stickySessionsEnabledValue != null && !stickySessionsEnabledValue.trim().isEmpty()) {
      stickySessionsEnabled = Boolean.parseBoolean(stickySessionsEnabledValue);
    }
    if (loadBalancingEnabledValue != null && !loadBalancingEnabledValue.trim().isEmpty()) {
      loadBalancingEnabled = Boolean.parseBoolean(loadBalancingEnabledValue);
    }
    if (stickySessionCookieNameValue != null && !stickySessionCookieNameValue.trim().isEmpty()) {
      stickySessionCookieName = stickySessionCookieNameValue;
    }
    if (noFallbackEnabledValue != null && !noFallbackEnabledValue.trim().isEmpty()) {
      noFallbackEnabled = Boolean.parseBoolean(noFallbackEnabledValue);
    }
    if(StringUtils.isNotBlank(disableLoadBalancingForUserAgentsValue)) {
      disableLoadBalancingForUserAgentsConfig = disableLoadBalancingForUserAgentsValue;
    }

    if (failoverNonIdempotentRequestEnabledValue != null && !failoverNonIdempotentRequestEnabledValue.trim().isEmpty()) {
      failoverNonIdempotentRequestEnabled = Boolean.parseBoolean(failoverNonIdempotentRequestEnabledValue);
    }

    return createServiceConfig(serviceName, enabled, maxFailoverAttempts, failoverSleep, zookeeperEnsemble, zookeeperNamespace, stickySessionsEnabled, loadBalancingEnabled,
        stickySessionCookieName, noFallbackEnabled, disableLoadBalancingForUserAgentsConfig, failoverNonIdempotentRequestEnabled);


  }