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

com.danielflower.apprunner.web.ProxyMap Maven / Gradle / Ivy

Go to download

A self-hosted platform-as-a-service that hosts web apps written in Java, Clojure, NodeJS, Python, golang and Scala.

There is a newer version: 2.4.6
Show newest version
package com.danielflower.apprunner.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URL;
import java.util.concurrent.ConcurrentHashMap;

public class ProxyMap {
    public static final Logger log = LoggerFactory.getLogger(ProxyMap.class);
    private final ConcurrentHashMap mapping = new ConcurrentHashMap<>();

    public void add(String prefix, URL url) {
        URL old = mapping.put(prefix, url);
        if (old == null) {
            log.info(prefix + " maps to " + url);
        } else {
            log.info(prefix + " maps to " + url + " (previously " + old + ")");
        }
    }

    public void remove(String prefix) {
        URL remove = mapping.remove(prefix);
        if (remove == null) {
            log.info("Removed " + prefix + " mapping to " + remove);
        }
    }

    public URL get(String prefix) {
        return mapping.getOrDefault(prefix, null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy