All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bdeploy.common.cfg.RemoteValidator Maven / Gradle / Ivy

Go to download

Public API including dependencies, ready to be used for integrations and plugins.

There is a newer version: 7.3.6
Show newest version
package io.bdeploy.common.cfg;

import io.bdeploy.common.cfg.Configuration.ConfigValidator;
import io.bdeploy.common.cfg.Configuration.ValidationMessage;

@ValidationMessage("Invalid remote: '%s'. A remote must be a local path or start with 'https://' and end with '/api'")
public class RemoteValidator implements ConfigValidator {

    @Override
    public boolean validate(String value) {
        String lower = value.toLowerCase();

        // Allow local paths and file URLs
        if (lower.startsWith("/") || lower.startsWith(".") || lower.startsWith("file:") || lower.startsWith("jar:file:")) {
            return true;
        }

        return lower.startsWith("https://") && lower.endsWith("/api");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy