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

org.xbib.net.scheme.HttpScheme Maven / Gradle / Ivy

package org.xbib.net.scheme;

import org.xbib.net.URL;
import org.xbib.net.path.PathNormalizer;

import java.util.Locale;

/**
 * HTTP scheme.
 */
class HttpScheme extends AbstractScheme {

    HttpScheme() {
        super("http", 80);
    }

    HttpScheme(String name, int port) {
        super(name, port);
    }

    @Override
    public URL normalize(URL url) {
        String host = url.getHost();
        if (host != null) {
            host = host.toLowerCase(Locale.ROOT);
        }
        return URL.builder()
                .scheme(url.getScheme())
                .userInfo(url.getUserInfo())
                .host(host, url.getProtocolVersion())
                .port(url.getPort())
                .path(PathNormalizer.normalize(url.getPath()))
                .query(url.getQuery())
                .fragment(url.getFragment())
                .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy