public static String urlWithProtocol(String url) { if (url.startsWith("http://") || url.startsWith("https://")) { return url; } else { return Msc.http() + "://" + url; } }
public static String localUrl(String urlPath) { U.must(urlPath.startsWith("/"), "Invalid URL path, it must start with '/'!"); int port = Conf.ON.entry("port").or(8080); return Msc.http() + "://localhost:" + port + urlPath; }
private Map<String, Object> createRoot() { Map<String, Object> spec = Coll.deepCopyOf(cfg.toMap()); if (spec.isEmpty()) { Map<String, Object> info = U.map( "version", cfg.entry("version").or("0"), "title", cfg.entry("title").or("Untitled") ); spec.put("info", info); Map<String, Object> servers = U.map( "url", Msc.http() + "://localhost:" + Conf.ON.entry("port").or(8080) + "/" ); spec.put("servers", servers); } return spec; }