/*
(non-Javadoc)

@see io.parallec.core.taskbuilder.targethosts.ITargetHostsBuilder#
setTargetHostsFromCmsQueryUrl(java.lang.String, java.lang.String, java.lang.String)
326803
@Override
    public List<String> setTargetHostsFromCmsQueryUrl(String cmsQueryUrl,
            String projection, String token) {

        List<String> targetHosts = new ArrayList<String>();

        try {

            if (projection == null || projection.isEmpty()) {
                logger.info("will use default project label");
                projection = "label";
            }
            TargetHostsBuilderHelperCms helper = new TargetHostsBuilderHelperCms();
            targetHosts = helper.getNodeListCompleteURLForCMS(cmsQueryUrl,
                    projection, token);

        } catch (Exception e) {
            throw new TargetHostsLoadException("error when reading  "
                    + cmsQueryUrl, e);
        }

        return targetHosts;

    }
1159744
public void setUrlPatterns(Collection<String> urlPatterns) {
		Assert.notNull(urlPatterns, "UrlPatterns must not be null");
		this.urlPatterns = new LinkedHashSet<>(urlPatterns);
	}
309708
public void setTargetTags(java.util.Collection<String> targetTags) {
        if (targetTags == null) {
            this.targetTags = null;
            return;
        }

        this.targetTags = new java.util.ArrayList<String>(targetTags);
    }
1008781
public void setSourceUrl(java.util.Collection<StringFilter> sourceUrl) {
        if (sourceUrl == null) {
            this.sourceUrl = null;
            return;
        }

        this.sourceUrl = new java.util.ArrayList<StringFilter>(sourceUrl);
    }
1327106
public void setCmsSources(com.google.api.ads.admanager.axis.v201811.CmsContent[] cmsSources) {
        this.cmsSources = cmsSources;
    }
545576
public void addMappingTarget(String mapping, RequestProcessor target) throws Exception
	{
		context.addMappingTarget(mapping, target);
	}
1007888
@Override
    public void setRedirectLocation(String location, String renderUrlParamName) {
        this.location = location;
        this.renderUrlParamName = renderUrlParamName;
    }
1144378
protected void setRequestUrl(MockServletRequest request,
			Map<String, String> variantMap, String path, JawrConfig config) {

		String domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL;

		if (JawrConstant.SSL.equals(variantMap
				.get(JawrConstant.CONNECTION_TYPE_VARIANT_TYPE))) {
			// Use the contextPathSslOverride property if it's an absolute URL
			if (StringUtils.isNotEmpty(config.getContextPathSslOverride())
					&& config.getContextPathSslOverride().startsWith(
							JawrConstant.HTTPS_URL_PREFIX)) {
				domainURL = config.getContextPathSslOverride();
			} else {
				domainURL = JawrConstant.HTTPS_URL_PREFIX + DEFAULT_WEBAPP_URL;
			}
		} else {
			// Use the contextPathOverride property if it's an absolute URL
			if (StringUtils.isNotEmpty(config.getContextPathOverride())
					&& config.getContextPathOverride().startsWith(
							JawrConstant.HTTP_URL_PREFIX)) {
				domainURL = config.getContextPathOverride();
			} else {
				domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL;
			}
		}

		request.setRequestUrl(PathNormalizer.joinDomainToPath(domainURL, path));
	}
700083
public void setTargetedRequestPlatforms(com.google.api.ads.admanager.axis.v201808.RequestPlatform[] targetedRequestPlatforms) {
        this.targetedRequestPlatforms = targetedRequestPlatforms;
    }
1167989
@Override
    public void setTargetType(String newTargetType) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setTargetType", newTargetType);

        // Check for null and empty string, and set to default value if found
        if ((newTargetType == null) || ("".equals(newTargetType))) {
            jcaManagedConnectionFactory.setTargetType(ApiJmsConstants.TARGET_TYPE_BUSMEMBER);
        }
        // Ensure that the value is one of the permitted constants - thrown an exception if not
        else if ((ApiJmsConstants.TARGET_TYPE_BUSMEMBER.equals(newTargetType))
                 || (ApiJmsConstants.TARGET_TYPE_CUSTOM.equals(newTargetType))
                 || (ApiJmsConstants.TARGET_TYPE_ME.equals(newTargetType))) {
            jcaManagedConnectionFactory.setTargetType(newTargetType);
        }
        else {
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "INVALID_VALUE_CWSIA0261",
                                                            new Object[] { "remoteTargetType", newTargetType },
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setTargetType");
    }
605561
@Override
    public void setBaseUrl(String baseUrl){
        this.endpointUrl = Utils.trimEnd(baseUrl, '/');
        super.setBaseUrl(baseUrl);
    }
1056654
public void setUrl(String url) {
        this.url = url;

        if (child != null) {
            child.destroy();
            child = null;
        }

        if (url.startsWith("http") || !url.endsWith(".fsp")) {
            child = new Iframe();
            ((Iframe) child).setSrc(url);
        } else {
            child = new Import();
            ((Import) child).setSrc(url);
        }

        fullSize(child);
        root.addChild(child);
    }
663403
public SetDomainCacheTTLResponse setDomainCacheTTL(SetDomainCacheTTLRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
        internalRequest.addParameter("cacheTTL","");
        this.attachRequestToBody(request, internalRequest);
        return invokeHttpClient(internalRequest, SetDomainCacheTTLResponse.class);
    }
1014180
public static HttpResult executeSearch(AsyncHttpClient client, HttpMethod method, String host,
                                     String path, String searchQuery) {
        RequestBuilder requestBuilder = new RequestBuilder(method.name());

        log.debug("Executing request against host {} with path {}",host,path);
        if(searchQuery!=null) {
            requestBuilder.setBody(searchQuery);
        }

        requestBuilder.setUrl(host + path);
        try {
            Response res = client.executeRequest(requestBuilder.build(),new AsyncCompletionHandlerBase()).get();
            return new HttpResult(HttpSearchExecutionStatus.OK,res.getResponseBody());
        } catch (Exception e) {
            Throwable cause = e.getCause();
            if(cause!=null) {
                if(cause instanceof ConnectException)
                {
                    log.error("Unable to connect to {}",host,e);
                    return HttpResult.CONNECTION_FAILURE;
                }
                else if (cause instanceof TimeoutException) {
                    log.error("Request timeout talking to {}",host,e);
                    return HttpResult.REQUEST_TIMEOUT_FAILURE;
                }
                else if (cause instanceof IOException && cause.getMessage().equalsIgnoreCase("closed")) {
                    log.warn("Unable to use client, client is closed");
                    return HttpResult.CLIENT_CLOSED;
                }
                else {
                    log.error("Exception talking to {}",host,e);
                    return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null);
                }
            }
            else {
                if (e instanceof IOException && e.getMessage().equalsIgnoreCase("closed")) {
                    log.warn("Unable to use client, client is closed");
                    return HttpResult.CLIENT_CLOSED;
                } else {
                    log.error("Exception talking to {}",host,e);
                    return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null);
                }
            }
        }
    }
983768
public void setUrls( String[] urls )
    {
        if ( urls == null )
        {
            this.urls = null;
        }
        else
        {
            this.urls = new String[urls.length];
            System.arraycopy( urls, 0, this.urls, 0, urls.length );
        }
    }
932333
public RequestTemplate target(String target) {
    /* target can be empty */
    if (Util.isBlank(target)) {
      return this;
    }

    /* verify that the target contains the scheme, host and port */
    if (!UriUtils.isAbsolute(target)) {
      throw new IllegalArgumentException("target values must be absolute.");
    }
    if (target.endsWith("/")) {
      target = target.substring(0, target.length() - 1);
    }
    try {
      /* parse the target */
      URI targetUri = URI.create(target);

      if (Util.isNotBlank(targetUri.getRawQuery())) {
        /*
         * target has a query string, we need to make sure that they are recorded as queries
         */
        this.extractQueryTemplates(targetUri.getRawQuery(), true);
      }

      /* strip the query string */
      this.target = targetUri.getScheme() + "://" + targetUri.getAuthority() + targetUri.getPath();
      if (targetUri.getFragment() != null) {
        this.fragment = "#" + targetUri.getFragment();
      }
    } catch (IllegalArgumentException iae) {
      /* the uri provided is not a valid one, we can't continue */
      throw new IllegalArgumentException("Target is not a valid URI.", iae);
    }
    return this;
  }
799086
public void setParamTabWpFolder(String value) {

        // perform self - healing
        if (!getCms().existsResource(value, CmsResourceFilter.IGNORE_EXPIRATION)) {
            value = "/";
        }
        m_userSettings.setStartFolder(value);
    }