Example usage for org.apache.commons.validator.routines UrlValidator isValid

List of usage examples for org.apache.commons.validator.routines UrlValidator isValid

Introduction

In this page you can find the example usage for org.apache.commons.validator.routines UrlValidator isValid.

Prototype

public boolean isValid(String value) 

Source Link

Document

Checks if a field has a valid url address.

Usage

From source file:org.lirazs.gbackbone.validation.client.rule.UrlRule.java

@Override
public boolean isValid(final String url, String attribute) {
    String[] schemes = ruleAnnotation.schemes();
    long options = ruleAnnotation.allowFragments() ? 0 : UrlValidator.NO_FRAGMENTS;

    UrlValidator urlValidator = schemes != null && schemes.length > 0 ? new UrlValidator(schemes, options)
            : UrlValidator.getInstance();

    return urlValidator.isValid(url);
}

From source file:org.meruvian.yama.showcase.action.application.ApplicationAction.java

private void validateApplication(Application app, String appname) {
    if (StringUtils.isBlank(app.getDisplayName())) {
        addFieldError("app.displayName", getText("message.application.name.notempty"));
    }//  ww w . jav a2s. c o  m

    if (StringUtils.isBlank(app.getSite())) {
        addFieldError("app.site", getText("message.application.site.notempty"));
    }

    UrlValidator validator = new UrlValidator(new String[] { "http", "https" });
    if (!validator.isValid(app.getSite())) {
        addFieldError("app.site", getText("message.application.site.notvalid"));
    }
}

From source file:org.mule.modules.validation.ValidationModule.java

/**
 * If the specified <code>url</code> is not a valid one throw an exception.
 * <p/>//w  ww  .  j  av  a2 s  .c om
 * {@sample.xml ../../../doc/mule-module-validation.xml.sample validation:validate-url}
 *
 * @param url                      URL to validate
 * @param allowTwoSlashes          Allow two slashes in the path component of the URL.
 * @param allowAllSchemes          Allows all validly formatted schemes to pass validation instead of supplying a set of valid schemes.
 * @param allowLocalURLs           Allow local URLs, such as http://localhost/ or http://machine/ .
 * @param noFragments              Enabling this options disallows any URL fragments.
 * @param customExceptionClassName Class name of the exception to throw
 * @throws Exception if not valid
 */
@Processor
public void validateUrl(String url, @Optional @Default("false") boolean allowTwoSlashes,
        @Optional @Default("false") boolean allowAllSchemes, @Optional @Default("false") boolean allowLocalURLs,
        @Optional @Default("false") boolean noFragments,
        @Optional @Default("org.mule.modules.validation.InvalidException") String customExceptionClassName)
        throws Exception {
    long options = 0;

    if (allowAllSchemes) {
        options |= UrlValidator.ALLOW_ALL_SCHEMES;
    }
    if (allowTwoSlashes) {
        options |= UrlValidator.ALLOW_2_SLASHES;
    }
    if (allowLocalURLs) {
        options |= UrlValidator.ALLOW_LOCAL_URLS;
    }
    if (noFragments) {
        options |= UrlValidator.NO_FRAGMENTS;
    }

    UrlValidator validator = new UrlValidator(options);

    if (!validator.isValid(url)) {
        throw buildException(customExceptionClassName);
    }
}

From source file:org.openbaton.nfvo.core.api.NetworkServiceDescriptorManagement.java

/**
 * This operation allows submitting and validating a Network Service Descriptor (NSD), including
 * any related VNFFGD and VLD.//w w w .j  a v  a2s .  com
 */
@Override
public NetworkServiceDescriptor onboard(NetworkServiceDescriptor networkServiceDescriptor, String projectId)
        throws NotFoundException, BadFormatException, NetworkServiceIntegrityException,
        CyclicDependenciesException {

    log.info("Staring onboarding process for NSD: " + networkServiceDescriptor.getName());
    UrlValidator urlValidator = new UrlValidator();

    nsdUtils.fetchExistingVnfd(networkServiceDescriptor);

    for (VirtualNetworkFunctionDescriptor vnfd : networkServiceDescriptor.getVnfd()) {
        vnfd.setProjectId(projectId);
        for (VirtualDeploymentUnit virtualDeploymentUnit : vnfd.getVdu()) {
            virtualDeploymentUnit.setProjectId(projectId);
        }
        if (vnfd.getLifecycle_event() != null)
            for (LifecycleEvent event : vnfd.getLifecycle_event()) {
                if (event == null) {
                    throw new NotFoundException("LifecycleEvent is null");
                } else if (event.getEvent() == null) {
                    throw new NotFoundException("Event in one LifecycleEvent does not exist");
                }
            }
        if (vnfd.getEndpoint() == null)
            vnfd.setEndpoint(vnfd.getType());
        if (vnfd.getVnfPackageLocation() != null) {
            if (urlValidator.isValid(vnfd.getVnfPackageLocation())) { // this is a script link
                VNFPackage vnfPackage = new VNFPackage();
                vnfPackage.setScriptsLink(vnfd.getVnfPackageLocation());
                vnfPackage.setName(vnfd.getName());
                vnfPackage.setProjectId(projectId);
                vnfPackage = vnfPackageRepository.save(vnfPackage);
                vnfd.setVnfPackageLocation(vnfPackage.getId());
            } else { // this is an id pointing to a package already existing
                // nothing to do here i think...
            }
        } else
            log.warn("vnfPackageLocation is null. Are you sure?");
    }

    log.info("Checking if Vnfm is running...");

    Iterable<VnfmManagerEndpoint> endpoints = vnfmManagerEndpointRepository.findAll();

    nsdUtils.checkEndpoint(networkServiceDescriptor, endpoints);

    log.trace("Creating " + networkServiceDescriptor);
    log.trace("Fetching Data");
    nsdUtils.fetchVimInstances(networkServiceDescriptor, projectId);
    log.trace("Fetched Data");

    log.debug("Checking integrity of NetworkServiceDescriptor");
    nsdUtils.checkIntegrity(networkServiceDescriptor);

    log.trace("Persisting VNFDependencies");
    nsdUtils.fetchDependencies(networkServiceDescriptor);
    log.trace("Persisted VNFDependencies");

    networkServiceDescriptor.setProjectId(projectId);
    networkServiceDescriptor = nsdRepository.save(networkServiceDescriptor);
    log.info("Created NetworkServiceDescriptor with id " + networkServiceDescriptor.getId());
    return networkServiceDescriptor;
}

From source file:org.openbaton.nfvo.core.utils.NSDUtils.java

public void checkIntegrity(VirtualNetworkFunctionDescriptor virtualNetworkFunctionDescriptor)
        throws NetworkServiceIntegrityException {
    UrlValidator urlValidator = new UrlValidator();

    /** check flavours and images */
    Set<String> flavors = new HashSet<>();
    Set<String> imageNames = new HashSet<>();
    Set<String> imageIds = new HashSet<>();
    Set<String> internalVirtualLink = new HashSet<>();
    //    Set<String> virtualLinkDescriptors = new HashSet<>();
    Set<String> names = new HashSet<>();
    names.clear();/*from   w  ww. j av  a  2s .c o m*/
    internalVirtualLink.clear();

    if (virtualNetworkFunctionDescriptor.getName() == null
            || virtualNetworkFunctionDescriptor.getName().isEmpty()) {
        throw new NetworkServiceIntegrityException("Not found name of VNFD. Must be defined");
    }

    if (virtualNetworkFunctionDescriptor.getType() == null
            || virtualNetworkFunctionDescriptor.getType().isEmpty()) {
        throw new NetworkServiceIntegrityException(
                "Not found type of VNFD " + virtualNetworkFunctionDescriptor.getName());
    }

    if (virtualNetworkFunctionDescriptor.getDeployment_flavour() != null
            && !virtualNetworkFunctionDescriptor.getDeployment_flavour().isEmpty()) {
        for (DeploymentFlavour deploymentFlavour : virtualNetworkFunctionDescriptor.getDeployment_flavour()) {
            if (deploymentFlavour.getFlavour_key() != null && !deploymentFlavour.getFlavour_key().isEmpty()) {
                names.add(deploymentFlavour.getFlavour_key());
            } else {
                throw new NetworkServiceIntegrityException("Deployment flavor of VNFD "
                        + virtualNetworkFunctionDescriptor.getName() + " is not well defined");
            }
        }
    } else {
        for (VirtualDeploymentUnit vdu : virtualNetworkFunctionDescriptor.getVdu()) {
            if (vdu.getComputation_requirement() == null || vdu.getComputation_requirement().isEmpty()) {
                throw new NetworkServiceIntegrityException("Flavour must be set in VNFD or all VDUs: "
                        + virtualNetworkFunctionDescriptor.getName()
                        + ". Come on... check the PoP page and pick at least one " + "DeploymentFlavor");
            } else {
                names.add(vdu.getComputation_requirement());
            }
        }
    }

    if (virtualNetworkFunctionDescriptor.getEndpoint() == null
            || virtualNetworkFunctionDescriptor.getEndpoint().isEmpty()) {
        throw new NetworkServiceIntegrityException(
                "Not found endpoint in VNFD " + virtualNetworkFunctionDescriptor.getName());
    }
    if (virtualNetworkFunctionDescriptor.getVdu() == null
            || virtualNetworkFunctionDescriptor.getVdu().size() == 0)
        throw new NetworkServiceIntegrityException(
                "Not found any VDU defined in VNFD \" + virtualNetworkFunctionDescriptor.getName()");
    int i = 1;
    for (VirtualDeploymentUnit vdu : virtualNetworkFunctionDescriptor.getVdu()) {
        if (vdu.getVnfc() == null || vdu.getVnfc().size() == 0)
            throw new NetworkServiceIntegrityException(
                    "Not found any VNFC in VDU of VNFD " + virtualNetworkFunctionDescriptor.getName());
        if (vdu.getName() == null || vdu.getName().isEmpty()) {
            vdu.setName(virtualNetworkFunctionDescriptor.getName() + "-" + i);
            i++;
        }
        if (vdu.getVm_image() == null || vdu.getVm_image().isEmpty()) {
            throw new NetworkServiceIntegrityException(
                    "Not found image in a VDU of VNFD " + virtualNetworkFunctionDescriptor.getName());
        }
        vdu.setProjectId(virtualNetworkFunctionDescriptor.getProjectId());
    }

    if (virtualNetworkFunctionDescriptor.getVirtual_link() != null) {
        for (InternalVirtualLink vl : virtualNetworkFunctionDescriptor.getVirtual_link()) {
            if (vl.getName() == null || Objects.equals(vl.getName(), ""))
                throw new NetworkServiceIntegrityException(
                        "The vnfd: " + virtualNetworkFunctionDescriptor.getName()
                                + " has a virtual link with no name specified");
        }
    }

    if (virtualNetworkFunctionDescriptor.getLifecycle_event() != null) {
        for (LifecycleEvent event : virtualNetworkFunctionDescriptor.getLifecycle_event()) {
            if (event == null) {
                throw new NetworkServiceIntegrityException("LifecycleEvent is null");
            } else if (event.getEvent() == null) {
                throw new NetworkServiceIntegrityException("Event in one LifecycleEvent does not exist");
            }
        }
    }
    if (virtualNetworkFunctionDescriptor.getVirtual_link() != null) {
        for (InternalVirtualLink internalVirtualLink1 : virtualNetworkFunctionDescriptor.getVirtual_link()) {
            internalVirtualLink.add(internalVirtualLink1.getName());
        }
    } else {
        virtualNetworkFunctionDescriptor.setVirtual_link(new HashSet<InternalVirtualLink>());
    }

    if (virtualNetworkFunctionDescriptor.getVnfPackageLocation() != null) {
        if (urlValidator.isValid(virtualNetworkFunctionDescriptor.getVnfPackageLocation())) { // this is a script link
            VNFPackage vnfPackage = new VNFPackage();
            vnfPackage.setScriptsLink(virtualNetworkFunctionDescriptor.getVnfPackageLocation());
            vnfPackage.setName(virtualNetworkFunctionDescriptor.getName());
            vnfPackage.setProjectId(virtualNetworkFunctionDescriptor.getProjectId());
            vnfPackage = vnfPackageRepository.save(vnfPackage);
            virtualNetworkFunctionDescriptor.setVnfPackageLocation(vnfPackage.getId());
        }
    } else
        log.warn("vnfPackageLocation is null. Are you sure?");

    if (virtualNetworkFunctionDescriptor.getVdu() != null) {
        for (VirtualDeploymentUnit virtualDeploymentUnit : virtualNetworkFunctionDescriptor.getVdu()) {
            if (inAllVims.equals("in-all-vims")) {
                if (virtualDeploymentUnit.getVimInstanceName() != null
                        && !virtualDeploymentUnit.getVimInstanceName().isEmpty()) {
                    for (String vimName : virtualDeploymentUnit.getVimInstanceName()) {
                        VimInstance vimInstance = null;
                        for (VimInstance vi : vimRepository
                                .findByProjectId(virtualNetworkFunctionDescriptor.getProjectId())) {
                            if (vimName.equals(vi.getName())) {
                                vimInstance = vi;
                                log.debug("Got vim with auth: " + vimInstance.getAuthUrl());
                                break;
                            }
                        }

                        if (vimInstance == null) {
                            throw new NetworkServiceIntegrityException("Not found VIM with name " + vimName
                                    + " referenced by VNFD " + virtualNetworkFunctionDescriptor.getName()
                                    + " and VDU " + virtualDeploymentUnit.getName());
                        }

                        if (virtualDeploymentUnit.getScale_in_out() < 1) {
                            throw new NetworkServiceIntegrityException(
                                    "Regarding the VirtualNetworkFunctionDescriptor "
                                            + virtualNetworkFunctionDescriptor.getName()
                                            + ": in one of the VirtualDeploymentUnit, the scale_in_out"
                                            + " parameter (" + virtualDeploymentUnit.getScale_in_out()
                                            + ") must be at least 1");
                        }
                        if (virtualDeploymentUnit.getScale_in_out() < virtualDeploymentUnit.getVnfc().size()) {
                            throw new NetworkServiceIntegrityException(
                                    "Regarding the VirtualNetworkFunctionDescriptor "
                                            + virtualNetworkFunctionDescriptor.getName()
                                            + ": in one of the VirtualDeploymentUnit, the scale_in_out"
                                            + " parameter (" + virtualDeploymentUnit.getScale_in_out()
                                            + ") must not be less than the number of starting "
                                            + "VNFComponent: " + virtualDeploymentUnit.getVnfc().size());
                        }
                        if (vimInstance.getFlavours() == null)
                            throw new NetworkServiceIntegrityException(
                                    "No flavours found on your VIM instance, therefore it is not possible to on board your NSD");
                        for (DeploymentFlavour deploymentFlavour : vimInstance.getFlavours()) {
                            flavors.add(deploymentFlavour.getFlavour_key());
                        }

                        for (NFVImage image : vimInstance.getImages()) {
                            imageNames.add(image.getName());
                            imageIds.add(image.getExtId());
                        }

                        //All "names" must be contained in the "flavors"
                        if (!flavors.containsAll(names)) {
                            throw new NetworkServiceIntegrityException(
                                    "Regarding the VirtualNetworkFunctionDescriptor "
                                            + virtualNetworkFunctionDescriptor.getName()
                                            + ": in one of the VirtualDeploymentUnit, not all "
                                            + "DeploymentFlavour" + names
                                            + " are contained into the flavors of the vimInstance "
                                            + "chosen. Please choose one from: " + flavors);
                        }
                        if (virtualDeploymentUnit.getVm_image() != null) {
                            for (String image : virtualDeploymentUnit.getVm_image()) {
                                log.debug("Checking image: " + image);
                                if (!imageNames.contains(image) && !imageIds.contains(image)) {
                                    throw new NetworkServiceIntegrityException(
                                            "Regarding the VirtualNetworkFunctionDescriptor "
                                                    + virtualNetworkFunctionDescriptor.getName()
                                                    + ": in one of the VirtualDeploymentUnit, image" + image
                                                    + " is not contained into the images of the vimInstance "
                                                    + "chosen. Please choose one from: " + imageNames
                                                    + " or from " + imageIds);
                                }
                            }
                        }
                        flavors.clear();

                        //                for (VNFComponent vnfComponent : virtualDeploymentUnit.getVnfc()) {
                        //                  for (VNFDConnectionPoint connectionPoint : vnfComponent.getConnection_point()) {
                        //                    if (!internalVirtualLink.contains(
                        //                        connectionPoint.getVirtual_link_reference())) {
                        //                      throw new NetworkServiceIntegrityException(
                        //                          "Regarding the VirtualNetworkFunctionDescriptor "
                        //                              + virtualNetworkFunctionDescriptor.getName()
                        //                              + ": in one of the VirtualDeploymentUnit, the "
                        //                              + "virtualLinkReference "
                        //                              + connectionPoint.getVirtual_link_reference()
                        //                              + " of a VNFComponent is not contained in the "
                        //                              + "InternalVirtualLink "
                        //                              + internalVirtualLink);
                        //                    }
                        //                  }
                        //                }
                    }
                } else {
                    log.warn(
                            "Impossible to complete Integrity check because of missing VimInstances definition");
                }
            } else {
                log.error("" + inAllVims + " not yet implemented!");
                throw new UnsupportedOperationException("" + inAllVims + " not yet implemented!");
            }
        }
    } else {
        virtualNetworkFunctionDescriptor.setVdu(new HashSet<VirtualDeploymentUnit>());
    }
    //      if (!virtualLinkDescriptors.containsAll(internalVirtualLink)) {
    //        throw new NetworkServiceIntegrityException(
    //            "Regarding the VirtualNetworkFunctionDescriptor "
    //                + virtualNetworkFunctionDescriptor.getName()
    //                + ": the InternalVirtualLinks "
    //                + internalVirtualLink
    //                + " are not contained in the VirtualLinkDescriptors "
    //                + virtualLinkDescriptors);
    //      }
}

From source file:org.openecomp.sdc.common.util.ValidationUtils.java

public static boolean validateUrl(String url) {

    UrlValidator urlValidator = new UrlValidator();
    if (!urlValidator.isValid(url)) {
        return false;
    }/* w  w  w .j  a  v  a 2s. com*/
    if (NONE_UTF8_PATTERN.matcher(url).find()) {
        return false;
    }

    if (URL_INVALIDE_PATTERN.matcher(url).find()) {
        return false;
    }
    return true;

}

From source file:org.opens.tgol.validator.CreateContractFormValidator.java

/**
 *
 * @param userSubscriptionCommand/*from w  ww  .j av a2s .com*/
 * @param errors
 * @return
 */
private boolean checkContractUrl(CreateContractCommand createContractCommand, Errors errors) {
    String url = createContractCommand.getContractUrl().trim();
    if (StringUtils.isBlank(url)) {
        return true;
    }
    String[] schemes = { "http", "https" };
    UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_2_SLASHES);
    if (!urlValidator.isValid(url)) {
        errors.rejectValue(CONTRACT_URL_KEY, INVALID_URL_KEY);
        return false;
    }
    return true;
}

From source file:org.orcid.frontend.web.controllers.DeveloperToolsController.java

/**
 * Validates the ssoCredentials object/* w  w w .  j av a2s.  co  m*/
 * 
 * @param ssoCredentials
 * @return true if any error is found in the ssoCredentials object
 * */
private boolean validateSSOCredentials(SSOCredentials ssoCredentials) {
    boolean hasErrors = false;
    Set<RedirectUri> redirectUris = ssoCredentials.getRedirectUris();
    if (PojoUtil.isEmpty(ssoCredentials.getClientName())) {
        if (ssoCredentials.getClientName() == null) {
            ssoCredentials.setClientName(new Text());
        }
        ssoCredentials.getClientName()
                .setErrors(Arrays.asList(getMessage("manage.developer_tools.name_not_empty")));
        hasErrors = true;
    } else if (ssoCredentials.getClientName().getValue().length() > CLIENT_NAME_LENGTH) {
        ssoCredentials.getClientName()
                .setErrors(Arrays.asList(getMessage("manage.developer_tools.name_too_long")));
        hasErrors = true;
    } else if (OrcidStringUtils.hasHtml(ssoCredentials.getClientName().getValue())) {
        ssoCredentials.getClientName().setErrors(Arrays.asList(getMessage("manage.developer_tools.name.html")));
        hasErrors = true;
    } else {
        ssoCredentials.getClientName().setErrors(new ArrayList<String>());
    }

    if (PojoUtil.isEmpty(ssoCredentials.getClientDescription())) {
        if (ssoCredentials.getClientDescription() == null) {
            ssoCredentials.setClientDescription(new Text());
        }
        ssoCredentials.getClientDescription()
                .setErrors(Arrays.asList(getMessage("manage.developer_tools.description_not_empty")));
        hasErrors = true;
    } else if (OrcidStringUtils.hasHtml(ssoCredentials.getClientDescription().getValue())) {
        ssoCredentials.getClientDescription()
                .setErrors(Arrays.asList(getMessage("manage.developer_tools.description.html")));
        hasErrors = true;
    } else {
        ssoCredentials.getClientDescription().setErrors(new ArrayList<String>());
    }

    if (PojoUtil.isEmpty(ssoCredentials.getClientWebsite())) {
        if (ssoCredentials.getClientWebsite() == null) {
            ssoCredentials.setClientWebsite(new Text());
        }
        ssoCredentials.getClientWebsite()
                .setErrors(Arrays.asList(getMessage("manage.developer_tools.website_not_empty")));
        hasErrors = true;
    } else {
        List<String> errors = new ArrayList<String>();
        String[] schemes = { "http", "https", "ftp" };
        UrlValidator urlValidator = new UrlValidator(schemes);
        String websiteString = ssoCredentials.getClientWebsite().getValue();
        if (!urlValidator.isValid(websiteString))
            websiteString = "http://" + websiteString;

        // test validity again
        if (!urlValidator.isValid(websiteString)) {
            errors.add(getMessage("manage.developer_tools.invalid_website"));
        }
        ssoCredentials.getClientWebsite().setErrors(errors);
    }

    if (redirectUris == null || redirectUris.isEmpty()) {
        List<String> errors = new ArrayList<String>();
        errors.add(getMessage("manage.developer_tools.at_least_one"));
        ssoCredentials.setErrors(errors);
        hasErrors = true;
    } else {
        for (RedirectUri redirectUri : redirectUris) {
            List<String> errors = validateRedirectUri(redirectUri);
            if (errors != null) {
                redirectUri.setErrors(errors);
                hasErrors = true;
            }
        }
    }
    return hasErrors;
}

From source file:org.orcid.frontend.web.controllers.DeveloperToolsController.java

/**
 * Checks if a redirect uri contains a valid URI associated to it
 * /*from   w  w  w  .  jav a 2s. c  o  m*/
 * @param redirectUri
 * @return null if there are no errors, an List of strings containing error
 *         messages if any error happens
 * */
private List<String> validateRedirectUri(RedirectUri redirectUri) {
    List<String> errors = null;
    String[] schemes = { "http", "https" };
    UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_LOCAL_URLS);
    if (!PojoUtil.isEmpty(redirectUri.getValue())) {
        try {
            String redirectUriString = redirectUri.getValue().getValue();
            if (!urlValidator.isValid(redirectUriString)) {
                errors = new ArrayList<String>();
                errors.add(getMessage("manage.developer_tools.invalid_redirect_uri"));
            }
        } catch (NullPointerException npe) {
            errors = new ArrayList<String>();
            errors.add(getMessage("manage.developer_tools.empty_redirect_uri"));
        }
    } else {
        errors = new ArrayList<String>();
        errors.add(getMessage("manage.developer_tools.empty_redirect_uri"));
    }

    return errors;
}

From source file:org.sakaiproject.lrs.expapi.impl.TincanapiLearningResourceStoreProvider.java

/**
 * Read the setup from the configuration. All non-empty values will overwrite any values that may have been set due to DI
 * Values are prefixed with "lrs.[id]." so that multiple versions of this provider can be instantiated based on the id.
 *//*from  w w w  .  ja v  a 2 s  .  c o  m*/
private void readConfig() {
    if (StringUtils.isEmpty(id)) {
        throw new IllegalStateException("Invalid " + id + " for LRS provider, cannot start");
    }

    configPrefix = "lrs." + id + ".";

    String value = serverConfigurationService.getConfig(configPrefix + "url", "");
    url = StringUtils.isNotEmpty(value) ? value : url;

    // ensure the URL is valid and formatted the same way (add "/" if not on the end for example)
    UrlValidator urlValidator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);

    if (!urlValidator.isValid(url)) {
        throw new IllegalStateException("Invalid " + id + " LRS provider url (" + url + "), correct the "
                + configPrefix + "url config value");
    } /* won't work with some LRS
      else {
      if (!url.endsWith("/")) {
          url = url + "/";
      }
      }*/

    value = serverConfigurationService.getConfig(configPrefix + "request.timeout", "");

    try {
        timeout = StringUtils.isNotEmpty(value) ? Integer.parseInt(value) : timeout; // allow setter to override
    } catch (NumberFormatException e) {
        timeout = 0;
        logger.debug("{} request.timeout must be an integer value - using default setting", configPrefix, e);
    }

    // basic auth
    value = serverConfigurationService.getConfig(configPrefix + "basicAuthUserPass", "");
    basicAuthString = StringUtils.isNotEmpty(value) ? value : basicAuthString;

    // oauth fields
    value = serverConfigurationService.getConfig(configPrefix + "consumer.key", "");
    consumerKey = StringUtils.isNotEmpty(value) ? value : consumerKey;
    value = serverConfigurationService.getConfig(configPrefix + "consumer.secret", "");
    consumerSecret = StringUtils.isNotEmpty(value) ? value : consumerSecret;
    value = serverConfigurationService.getConfig(configPrefix + "realm", "");
    realm = StringUtils.isNotEmpty(value) ? value : realm;

    if (StringUtils.isEmpty(basicAuthString) && (StringUtils.isEmpty(consumerKey)
            || StringUtils.isEmpty(consumerSecret) || StringUtils.isEmpty(realm))) {
        throw new IllegalStateException(
                "No authentication configured properly for LRS provider, service cannot start. Please check the configuration");
    }
}