basic-lib/src/main/java/com/streamsets/pipeline/stage/origin/http/HttpClientSource.java
@Override
  protected List<ConfigIssue> init() {
    List<ConfigIssue> issues = super.init();
    errorRecordHandler = new DefaultErrorRecordHandler(getContext()); // NOSONAR

    conf.basic.init(getContext(), Groups.HTTP.name(), BASIC_CONFIG_PREFIX, issues);
    conf.dataFormatConfig.init(getContext(), conf.dataFormat, Groups.HTTP.name(), DATA_FORMAT_CONFIG_PREFIX, issues);
    conf.init(getContext(), Groups.HTTP.name(), "conf.", issues);
    if (conf.client.tlsConfig.isEnabled()) {
      conf.client.tlsConfig.init(getContext(), Groups.TLS.name(), TLS_CONFIG_PREFIX, issues);
    }

    resourceVars = getContext().createELVars();
    resourceEval = getContext().createELEval(RESOURCE_CONFIG_NAME);

    bodyVars = getContext().createELVars();
    bodyEval = getContext().createELEval(REQUEST_BODY_CONFIG_NAME);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(ZoneId.of(conf.timeZoneID)));
    TimeEL.setCalendarInContext(bodyVars, calendar);

    headerVars = getContext().createELVars();
    headerEval = getContext().createELEval(HEADER_CONFIG_NAME);

    stopVars = getContext().createELVars();
    stopEval = getContext().createELEval(STOP_CONFIG_NAME);

    next = null;
    haveMorePages = false;

    if (conf.responseStatusActionConfigs != null) {
      final String cfgName = "conf.responseStatusActionConfigs";
      final EnumSet<ResponseAction> backoffRetries = EnumSet.of(
          ResponseAction.RETRY_EXPONENTIAL_BACKOFF,
          ResponseAction.RETRY_LINEAR_BACKOFF
      );

      for (HttpResponseActionConfigBean actionConfig : conf.responseStatusActionConfigs) {
        final HttpResponseActionConfigBean prevAction = statusToActionConfigs.put(
            actionConfig.getStatusCode(),
            actionConfig
        );

        if (prevAction != null) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_17,
                actionConfig.getStatusCode()
            )
          );
        }
        if (backoffRetries.contains(actionConfig.getAction()) && actionConfig.getBackoffInterval() <= 0) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_15
            )
          );
        }
        if (actionConfig.getStatusCode() >= 200 && actionConfig.getStatusCode() < 300) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_16
            )
          );
        }
      }
    }
    this.timeoutActionConfig = conf.responseTimeoutActionConfig;

    // Validation succeeded so configure the client.
    if (issues.isEmpty()) {
      try {
        configureClient(issues);
      } catch (StageException e) {
        // should not happen on initial connect
        ExceptionUtils.throwUndeclared(e);
      }
    }
    return issues;
  }
@Override
  protected List<ConfigIssue> init() {
    List<ConfigIssue> issues = super.init();
    errorRecordHandler = new DefaultErrorRecordHandler(getContext()); // NOSONAR

    conf.basic.init(getContext(), Groups.HTTP.name(), BASIC_CONFIG_PREFIX, issues);
    conf.dataFormatConfig.init(getContext(), conf.dataFormat, Groups.HTTP.name(), DATA_FORMAT_CONFIG_PREFIX, issues);
    conf.init(getContext(), Groups.HTTP.name(), "conf.", issues);
    if (conf.client.tlsConfig.isEnabled()) {
      conf.client.tlsConfig.init(getContext(), Groups.TLS.name(), TLS_CONFIG_PREFIX, issues);
    }

    resourceVars = getContext().createELVars();
    resourceEval = getContext().createELEval(RESOURCE_CONFIG_NAME);

    bodyVars = getContext().createELVars();
    bodyEval = getContext().createELEval(REQUEST_BODY_CONFIG_NAME);
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(ZoneId.of(conf.timeZoneID)));
    TimeEL.setCalendarInContext(bodyVars, calendar);

    headerVars = getContext().createELVars();
    headerEval = getContext().createELEval(HEADER_CONFIG_NAME);

    stopVars = getContext().createELVars();
    stopEval = getContext().createELEval(STOP_CONFIG_NAME);

    next = null;
    haveMorePages = false;

    if (conf.responseStatusActionConfigs != null) {
      final String cfgName = "conf.responseStatusActionConfigs";
      final EnumSet<ResponseAction> backoffRetries = EnumSet.of(
          ResponseAction.RETRY_EXPONENTIAL_BACKOFF,
          ResponseAction.RETRY_LINEAR_BACKOFF
      );

      for (HttpResponseActionConfigBean actionConfig : conf.responseStatusActionConfigs) {
        final HttpResponseActionConfigBean prevAction = statusToActionConfigs.put(
            actionConfig.getStatusCode(),
            actionConfig
        );

        if (prevAction != null) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_17,
                actionConfig.getStatusCode()
            )
          );
        }
        if (backoffRetries.contains(actionConfig.getAction()) && actionConfig.getBackoffInterval() <= 0) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_15
            )
          );
        }
        if (actionConfig.getStatusCode() >= 200 && actionConfig.getStatusCode() < 300) {
          issues.add(
            getContext().createConfigIssue(
                Groups.HTTP.name(),
                cfgName,
                Errors.HTTP_16
            )
          );
        }
      }
    }
    this.timeoutActionConfig = conf.responseTimeoutActionConfig;

    // Validation succeeded so configure the client.
    if (issues.isEmpty()) {
      try {
        configureClient(issues);
      } catch (StageException e) {
        // should not happen on initial connect
        ExceptionUtils.throwUndeclared(e);
      }
    }
    return issues;
  }
@ Override protected List < ConfigIssue > init ( ) { List < ConfigIssue > issues = super . init ( ) ; errorRecordHandler = new DefaultErrorRecordHandler ( getContext ( ) ) ; // NOSONAR conf . basic . init ( getContext ( ) , Groups . HTTP . name ( ) , BASIC_CONFIG_PREFIX , issues ) ; conf . dataFormatConfig . init ( getContext ( ) , conf . dataFormat , Groups . HTTP . name ( ) , DATA_FORMAT_CONFIG_PREFIX , issues ) ; conf . init ( getContext ( ) , Groups . HTTP . name ( ) , "conf." , issues ) ; if ( conf . client . tlsConfig . isEnabled ( ) ) { conf . client . tlsConfig . init ( getContext ( ) , Groups . TLS . name ( ) , TLS_CONFIG_PREFIX , issues ) ; } resourceVars = getContext ( ) . createELVars ( ) ; resourceEval = getContext ( ) . createELEval ( RESOURCE_CONFIG_NAME ) ; bodyVars = getContext ( ) . createELVars ( ) ; bodyEval = getContext ( ) . createELEval ( REQUEST_BODY_CONFIG_NAME ) ; Calendar calendar = Calendar . getInstance ( TimeZone . getTimeZone ( ZoneId . of ( conf . timeZoneID ) ) ) ; TimeEL . setCalendarInContext ( bodyVars , calendar ) ; headerVars = getContext ( ) . createELVars ( ) ; headerEval = getContext ( ) . createELEval ( HEADER_CONFIG_NAME ) ; stopVars = getContext ( ) . createELVars ( ) ; stopEval = getContext ( ) . createELEval ( STOP_CONFIG_NAME ) ; next = null ; haveMorePages = false ; if ( conf . responseStatusActionConfigs != null ) { final String cfgName = "conf.responseStatusActionConfigs" ; final EnumSet < ResponseAction > backoffRetries = EnumSet . of ( ResponseAction . RETRY_EXPONENTIAL_BACKOFF , ResponseAction . RETRY_LINEAR_BACKOFF ) ; for ( HttpResponseActionConfigBean actionConfig : conf . responseStatusActionConfigs ) { final HttpResponseActionConfigBean prevAction = statusToActionConfigs . put ( actionConfig . getStatusCode ( ) , actionConfig ) ; if ( prevAction != null ) { issues . add ( getContext ( ) . createConfigIssue ( Groups . HTTP . name ( ) , cfgName , Errors . HTTP_17 , actionConfig . getStatusCode ( ) ) ) ; } if ( backoffRetries . contains ( actionConfig . getAction ( ) ) && actionConfig . getBackoffInterval ( ) <= 0 ) { issues . add ( getContext ( ) . createConfigIssue ( Groups . HTTP . name ( ) , cfgName , Errors . HTTP_15 ) ) ; } if ( actionConfig . getStatusCode ( ) >= 200 && actionConfig . getStatusCode ( ) < 300 ) { issues . add ( getContext ( ) . createConfigIssue ( Groups . HTTP . name ( ) , cfgName , Errors . HTTP_16 ) ) ; } } } this . timeoutActionConfig = conf . responseTimeoutActionConfig ; // Validation succeeded so configure the client. if ( issues . isEmpty ( ) ) { try { configureClient ( issues ) ; } catch ( StageException e ) { // should not happen on initial connect ExceptionUtils . throwUndeclared ( e ) ; } } return issues ; }
{@inheritDoc}
{