com.danielflower.apprunner.web.ProxyMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of app-runner Show documentation
Show all versions of app-runner Show documentation
A self-hosted platform-as-a-service that hosts web apps written in Java, Clojure, NodeJS, Python, golang and Scala.
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